When I do something like:

rsync Videos/YouTube/LetsPlays foo@bar:/home/foo/

The resulting directory structure looks like:


I've read the man pages but couldn't an option to maintain the directory structure, aiming for


as result. Any ideas?

As always thanks in regards, Markus


Use the -R or --relative option to preserve the full path.

If you do not want the full path of the remote file, but only part of that, rsync offers this feature since version 2.6.7 (this is the version on the sending side which is the local side in your case).

Just insert a dot /./ into the path where you want to break the path


rsync --relative Videos/./YouTube/LetsPlays foo@bar:/home/foo/

would result in this remote path:

  • Great answer, thank you. – Stephen Sep 13 '19 at 21:47

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.