I've a file that looks like this:


I'm calling rsync with:

rsync --files-from="/cygdrive/d/myfiles.txt" "/cygdrive/d/path/to/" "user@remotehost:/cygdrive/c/new/path/for"

I want rsync to make dir structure like:


But it's failing with errors like:

rsync: change_dir "/cygdrive/c/new/path/for/cygdrive/d/path/to/my" failed: No such file or directory rsync: mkstmp "/cygdrive/c/new/path/for/cygdrive/d/path/to/my/file1.png.asdjfhsdj" failed: No such file or directory

How do I make rsync understand that /cygdrive/d/path/to/ is the part of the source path that is the "root" and that only subfolders/files of it should be replicated to the destination root to give a new path at the destination?


It seems the bit specified on the command line is the "source root" part and the line from the file is the "relative" part.

Hence I needed to strip /cygdrive/d/path/to/ out of all the lines in the file leaving just my/file1.png

Then when called with the command line from the question, rsync assembled the local file path using the cmd_line_source + file_line, and copied it to cmd_line_dest + file_line

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.