How do I sync more than one directory in diferent destination in same comand (Drive, Windows)

Hello, so my question is:

If I have the following directorys: D:\hello and D:\goodbye and I want to sync everything in those two directorys in diferent destinations in Drive. How would the comand go to do that?
I’m able to do it one by one, but it would help if I didn’t have to do the same comand twice and just put it all in the same comand.

Thanks :slight_smile:

Depends on how you want to approach it.

You can either include or exclude.

I would probably include and use something like in this example:

One approach is to use the “–include-from” option.

Another approach is to script this, so the command gets run twice on your behalf. For example with powershell (as you are on windows):

foreach($dir in $syncDirs) {
rclone <command> <options>
save as ps1 and allow your win installation to run custom scripts (please read up on this), then just call the script.

edits = My formatting skills are stronk…

You’re not going to be able to sync to two destinations in a single command. The destination is a single destination. You could use trickery to get it to do it by using Linux bind mounts or sym links and to create a directory tree on the source that matches the destination locations though.

Edit: you’re on windows per the title. You could use the same approach with the windows equivalent of symlinks (junction) I think. I don’t use Windows though

So if I want to include all the files and subdirectorys from the D:\goodbye, I should do this command?:

rclone sync “D:\hello” --include “D:/goodbye/” example:hello --log-file “D:\logs\logs.txt” --stats-log-level NOTICE

I have been trying to make the –include and the –include-from comands make work, but nothing works and I have no idea why tbh.

So I did it using a filter-from which picks 2 directories and ignores everything else:

[felix@gemini ~]$ rclone sync --filter-from filter /home/felix GD: -P
Transferred:   	  928.326k / 928.326 kBytes, 100%, 23.922 kBytes/s, ETA 0s
Errors:                 0
Checks:                 0 / 0, -
Transferred:           84 / 84, 100%
Elapsed time:       38.8s

[felix@gemini ~]$ ls
filter  logs  scripts  test

[felix@gemini ~]$ cat filter
# a sample filter rule file
+ logs/**
+ scripts/**
# exclude everything else
- *

and the output:

 rclone lsd GD:
          -1 2018-06-07 10:05:06        -1 Arq Backup Data
          -1 2019-02-28 09:42:12        -1 backup
          -1 2019-04-05 06:51:48        -1 logs
          -1 2017-06-09 09:59:43        -1 media
          -1 2019-03-21 15:57:51        -1 papers
          -1 2019-04-05 06:51:49        -1 scripts

So wait, you telling me you have to copy, sync or move the directory and its files from the same directory you are in??
You can’t filter outside the directory you are in?

I’m not quite following what you are trying to do then as your example was using D: and including 2 folders there. I gave you an example to solve that.

Are you trying to do something else?

OHHHHH, I just realized how dumb I am and that you were outside of both directorys. My bad sry, was thinking about Windows and dindn’t realize you were in Linux.

But now I have another question. I understand how you can backup two seperate directories or even more that are in the same root directory, but can you do the same from D: towards C:?.

I want to backup D:\hello and D:\goodbye, but now I have C:\magic and I can’t move it because it’s in there and for some magic reasons you can’t move it. What should I do now?
Because from your example you can only backup things that are in the root of the directory you are trying to backup.

BTW thanks for being so patience with me :slight_smile:

Just run another command if you are trying to do different source drives. Not sure there is a way around that but I honestly am not a Windows users so not sure I could offer anymore.

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