Upload files from local Ubuntu PC to OneDrive using the terminal

1. Install rclone without curl:

Option A: Using wget (if available):

wget https://rclone.org/install.sh -O - | bash

Option B: Manual installation:

  • Visit https://rclone.org/downloads/ in your web browser
  • Download the appropriate version for your system (likely Linux-64bit)
  • Extract the downloaded archive
  • Move the rclone binary to a directory in your PATH, e.g.:
    mv rclone-v* rclone
    mkdir -p $HOME/bin
    mv rclone $HOME/bin/
    export PATH=$PATH:$HOME/bin
    

2. Configure rclone for OneDrive:

rclone config

Follow the prompts to set up a new remote for OneDrive (reference):

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> n
name> remote
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
[snip]
XX / Microsoft OneDrive
   \ "onedrive"
[snip]
Storage> onedrive
Microsoft App Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id>
Microsoft App Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret>
Edit advanced config? (y/n)
y) Yes
n) No
y/n> n
Remote config
Use web browser to automatically authenticate rclone with remote?
 * Say Y if the machine running rclone has a web browser you can use
 * Say N if running rclone on a (remote) machine without web browser access
If not sure try Y. If Y failed, try N.
y) Yes
n) No
y/n> y
If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth
Log in and authorize rclone for access
Waiting for code...
Got code
Choose a number from below, or type in an existing value
 1 / OneDrive Personal or Business
   \ "onedrive"
 2 / Sharepoint site
   \ "sharepoint"
 3 / Type in driveID
   \ "driveid"
 4 / Type in SiteID
   \ "siteid"
 5 / Search a Sharepoint site
   \ "search"
Your choice> 1
Found 1 drives, please select the one you want to use:
0: OneDrive (business) id=b!Eqwertyuiopasdfghjklzxcvbnm-7mnbvcxzlkjhgfdsapoiuytrewqk
Chose drive to use:> 0
Found drive 'root' of type 'business', URL: https://org-my.sharepoint.com/personal/you/Documents
Is that okay?
y) Yes
n) No
y/n> y
Configuration complete.
Options:
- type: onedrive
- token: {"access_token":"youraccesstoken","token_type":"Bearer","refresh_token":"yourrefreshtoken","expiry":"2018-08-26T22:39:52.486512262+08:00"}
- drive_id: b!Eqwertyuiopasdfghjklzxcvbnm-7mnbvcxzlkjhgfdsapoiuytrewqk
- drive_type: business
Keep this "remote" remote?
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y

3. Authenticate:

The config process will provide a URL. Open it in your browser, sign in to your Microsoft account, and grant the necessary permissions.

4. Upload files:

rclone copy /path/to/local/file onedrive:path/on/onedrive

5. Sync folders:

rclone sync /path/to/local/folder onedrive:path/on/onedrive

6. List files:

rclone ls onedrive:

If you don’t have wget either, you can download rclone manually from a web browser and follow the manual installation steps.

Alternatively, if you prefer a simpler solution without additional software, you could use the OneDrive web interface:

  1. Open https://onedrive.live.com in your web browser
  2. Sign in to your Microsoft account
  3. Use the web interface to upload files directly
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值