Merge folders together automatically?

I'm looking for a way to "merge folders" automatically similar to copying folders and files in Windows explorer, using rclone itself (i prefer using commandline instead of mounting a remote as a driveletter, i know that this way would also solve the issue). For eg if i have the following structure:

gdrive:/Example/Subfolder01
And
gdrive:/Example/Subfolder02
And Subfolder01 contains the files File01 and File02, while Subfolder 02 contains File03 and File04, then it would be great if i was able to give rclone instructions to copy folders and files to a given location and merge the structure together, so lets say Subfolder 01 is already on gdrive, and another folder called Example is on my local drive, i assume running for eg:

rclone copy x:\upload\Example gdrive:/Example

Will not work the way i want, instead overwriting existing folders and files completely with the new ones? I've read the documentation but i'm not really sure if this is possible or if i misunderstood the concept. It says that rsync and copy commands doesnt work the same that's why i'm kinda confused if it works and in that case how. Thankful for help :slight_smile:

What i look for is to be overly clear an end result on gdrive of

/Example
-/Subfolder01
-File 01 File 02
-/Subfolder02
-File 03 File 04

Copy will simply copy existing files on the source to the destination and overwrite any files that already existed with the same names. It won't delete the other ones (sync would do that!). So I think what you asked for will work in your use case.

But test it first with --dry-run -v to understand what it would have done.

rclone copy x:\upload\Example gdrive:/Example -v --dry-run

You can also use 'move' if you wanted to get rid of the source files after successful copy.

Thanks for clarification, i've read about that it overwrite files with the same name, thats why i assumed copying 2 folders containing files to the same sourcefolder on a remote would overwrite the entire folder so to speak, but i guess folders arent handeled the same way as files then, just wanted to make sure :slight_smile:

I will try the --dry-run flag as soon as i come back home, just read trough documentation and googling around and it almost seemed to me that i was out of luck but it sounds promising now.

EDIT: If it just ignores folders and a copy command should be seen as only copying files to a given source on the remote, i'm also thinking how it works with more subfolders in many levels with a little more complex folderstructure? Or are every subfolder "translated" to sourcedirections automatically? Sorry for my grammar, english is not my first language and i barely know how to explain what i look for in my native lang :wink:

rclone works on files and not really folders. So if you copy the files and the directories are the same it will just copy the new files into the existing folders. It will merge them with the current files that are there.

1 Like

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