I have two separate computers with the same MEDIA folder which is quite large. These folders have the same structure but in one computer there are more files.

What I would like to do is something like this:

1) Scan folder on computer A, create list of files I already have.

2) Copy list to a computer B and run "copy files that are not in the list" to my external drive.

Is it possible to do this with rsync?

Thank you so much, this would be really a powerful hack.

  • Are those two computers connected to the same network? If not, is it possible to connect them? Or the only option to "sync" them is via an external drive? – Eric Carvalho Aug 24 '15 at 13:48
  • No, they are not connected. That's why I would like to make a list of files I already have and to copy the rest of them. – Sebastian Aug 26 '15 at 12:59

Sync a directory from one computer to another using an external drive, without copying the whole directory:

  • In the destination (computer A, in your case):

    Generate the list of files you already have and save it to the external drive:

    find -type f | cut -c2- > /PATH/TO/EXTERNAL/DRIVE/my_files

    You have to cd to the folder you want to sync, so find will generate a list of files using relative paths.

  • In the origin (computer B, in your case):

    Copy only the files you don't have to the external drive:

    rsync -a --exclude-from=/PATH/TO/my_files /PATH/TO/MEDIA /PATH/TO/EXTERNAL/DRIVE

    Make sure you don't include a trailing slash (/) in /PATH/TO/MEDIA.

  • Back to destination (computer A, in your case):

    Copy the files from the external drive to your directory:


    Now, make sure you do include a trailing slash in /PATH/TO/EXTERNAL/DRIVE/MEDIA/.

More info: Rsync manual page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.