When backing up with rsync, How do I keep the full directory structure?

For example, the remote server is saturn, and I want to backup saturn's /home/udi/files/pictures to a local directory named backup.

I want to have (locally) backup/home/udi/files/pictures rather than backup/pictures.

Any help?

Udi

link|improve this question

78% accept rate
feedback

2 Answers

up vote 10 down vote accepted

Use the -R option to preserve the full path.

link|improve this answer
feedback

With the Cygwin Windows rsync, and assuming the remote rsync is pointing to the root, I'd do:

rsync -vtrz --delete server::rsyncid/home/udi/files/pictures /cygdrive/d/backup/home/udi/files

That will put the contents of the remote pictures directory in /backup/home/udi/files/pictures. Presumably the syntax under unix would be similar.

JR

link|improve this answer
It is not useful because we need to reproduce the whole directory hierarchy on the local side before executing the rsync command. – Ludovic Kuty Apr 2 at 11:42
feedback

Your Answer

 
or
required, but never shown

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