Rclone script in Linux

Hello, I apologize in advance for being stupid :laughing:

In Windows I have a simple script that displays information and disappears when I press a button (the same thing I would like in Linux)


rclone sync -P C:\Users\Windows\Desktop\seven\seven seven:/

test.sh (this doesn't work for me)

./rclone sync -P C:\Users\Windows\Desktop\seven\seven seven:/

What you want to do?

I suck at bash but something like this should work as a replacement:

read -n1 -r -p "Press any key to continue..." key


  • Linux doesn't have C: or a windows folder so obviously that part of your script is wrong. Your sync has to point to the right place to work
  • I don't think there is any "pause" function equivalent on Linux, so that last line there just tells the system to wait for user input - and we specify that input to be a single key of any type. That functionally works the same. You can edit the message in the quotes to your liking as that served no technical purpose other than to let you know it's paused.

rclone sync -P /path/to/file seven:/
read -n 1 -s -r -p "Press any key to continue"

ps: 1) pay attention to rclone path 2) Linux use / as directory separator.

@thestigma @bbassotti
Thank you all, it works perfectly

small question, what is the most used/best solution for filtering/multiple folders?
in my directory "seven" on linux I have 15 folders but only 3 of them, I want to synchronize.
should I list them all as individual commands, or can I list them in one sync command?

something like that:

./rclone sync -P [/home/seven/1+/home/seven2+/home/seven/3] seven:/
read -n 1 -s -r -p "Press any key to continue"

No, that synatx will not be valid. rclone needs 1 source and 1 destination

There's a few ways to handle it.
The primitive way would be to just make 3 sync commands after each other in the script - one for each folder.

./rclone sync /home/seven/1 seven: -P
./rclone sync /home/seven/2 seven: -P
./rclone sync /home/seven/3 seven: -P
read -n 1 -s -r -p "Press any key to continue"

This will work fine for this case since it's not very complex what you are trying to do here. (only 3 locations - and full sync of everything in them)

Second you can use rclone filtering system:
then you would do something like

rclone sync /home seven: --include seven*/** -P
read -n 1 -s -r -p "Press any key to continue"

In plain english that means: start the sync operation in the /home folder, but only work on the folders that start with "seven" (seven*) and all the files inside, including subfolders (/**)

Note that I have not tested these examples - they may have minor errors in them in sytax, but you should get the gist of it.

That is sufficient for your need here, but if you want to do really complicated filtering that you can't easily put into a single command you can also create a layered filtering file if need be (see the linked docs). What is the "best" way depends on the complexity - and also to an extent what you find to be the most intuitive to understand. If you have never used regular expressions (for the filtering) that might require a little bit of study to grasp.

If you are ever in dobut and don't want to mess up (because a sync can delete files if accidentally run with wrong settings) I highly recommend you do a trial-run by adding --dry-run to your command(s). This will simulate the sync but do no actions, letting you see what is going to happen. Especially if you also add --verbose (or just -v for short) so that it tells you all the files and folders it would transfer.

rclone sync /home seven: --include seven*/** -P -v --dry-run
read -n 1 -s -r -p "Press any key to continue"

Give those examples a try and let me know if that solves it for you :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.