rsync behaviour

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Wed Oct 26 23:16:14 UTC 2011


On Wed, Oct 26, 2011 at 06:20:02PM -0400, Thomas Milne wrote:
> When I do rsync -au ~/.config user at host:~/backup
> 
> it puts .config under ~/backup like so:
> 
> ~/backup/.config
> 
> but when I do rsync -au ~/Documents user at host:~/backup
> 
> it puts the _contents_ of Documents under ~/backup...so I lose the
> 'Documents' folder.
> 
> Is it because the first was a hidden dir?

You want:

rsync -au ~/Documents user at host:~/backup

Make sure you do not do:

rsync -au ~/Documents/ user at host:~/backup
by accident using tab completion.

A trailing slash means contents of directory rather than the directory
and contents.  I prefer to have a trailing slash on the target though
since otherwise if backup does not exist, it will think you wanted to copy
Documents as backup rather than into an existing directory named backup.

-- 
Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list