Sync a SINGLE directory

What is the problem you are having with rclone?

Wondering how I can sync a SINGLE directory ie:
Directory Structure:
Root > Folder1 > Folder2 > Folder3 > Folder4
and I want to sync only the files (and maybe Folder3), in Folder2.
Don't want to touch Root, Folder1 and Folder4

(but DO love, rclone!!)

What is your rclone version (output from rclone version)


Which OS you are using and how many bits (eg Windows 7, 64 bit)

Opensuse Leap 15.1 x64 fully Updated...

Which cloud storage system are you using? (eg Google Drive)

Google Drive/Box

The command you were trying to run (eg rclone copy /tmp remote:tmp)

Something like:
rclone sync -Pv GoogleDrive:PhoneStuff/ Box:PhoneStuff/

A log from the command with the -vv flag (eg output from rclone -vv copy /tmp remote:tmp)

Not Necessary...?

hmm... sync is by default recursive (ie. if you ask for folder 2 you get all suborders under it also). I don't think this behavior can be switched off.

So I think the best you can do would be:
rclone sync remote1:/Folder1/Folder2 remote2:/destinationfolder/ --exclude Folder4/*
(this should result in Folder 2 and 3 being synced, but not 4)

Because I suck at regex, you need to verify this is correct:
--exclude Folder4/*
only take that as a very rough example to be best of my (poor) ability.
I think that should match all files inside any folder named "Folder4" (excluding them that is).

You can read up on filtering here to get a better understanding of what is possible:

and if you need more help on regex there are other people here who are actually good at it, so don't worry :smiley:

You can use --max-depth 1 which I think will work with sync...

Filtering is the more general purpose idea though in which case you'd use a --filter-from file with this contents

+ /Folder3/*
+ /*
- *

Nice! I forgot about max-depth.
That would absolutely be the easiest fix for this spesific circumstance, but it isn't all that flexible.

That works!

1 Like

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