Two-way Sync of Directories - how? (rsync?)
Bill Campbell
freebsd at celestial.com
Sun Mar 14 22:54:03 PST 2004
On Mon, Mar 15, 2004, Kai Grossjohann wrote:
...
>Explaining the trailing slash is more difficult. I just remember a
>rule of thumb: if you want to copy directories with rsync, always
>specify a trailing slash. On both the source and the destination. Of
>course, "man rsync" has the full story...
I find this is a bit tricky, and non-intuitive. If I do:
rsync -var ./ system:dest/
Everything in the current directory is copied to the remote directory as it
appears in the current directory.
rsync -var subdir system:dest/
copies subdir to system:dest/subdir
rsunc -var subdir/ system:dest/
copies subdir/* to systems:dest
I often have use the ``-n'' option first to make sure it's going to do what
I want before doing the real transfer.
Incidently if one leaves off the trailing ``.'' for the destination when
copying from a remote system to the current directory, rsync will show what
it will copy if you have it set for verbose output, but won't do the copy.
rsync -vaP remote:/path/\*.sh
This will show which files it would copy
rsync -vaP remote:/path/\*.sh .
This will do the copy.
Bill
--
INTERNET: bill at Celestial.COM Bill Campbell; Celestial Software LLC
UUCP: camco!bill PO Box 820; 6641 E. Mercer Way
FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676
"Avoid revolution or expect to get shot. Mother and I will grieve, but
we will gladly buy a dinner for the National Guardsman who shot you."
-- Dr. Paul Williamson, father of a Kent State student
More information about the freebsd-questions
mailing list