[K12OSN] rsync
Petre Scheie
petre at maltzen.net
Mon Oct 10 16:17:31 UTC 2005
My only hesitation about cd'ing into a directory and then doing something in that
directory, instead of just doing the work using a fully qualified path to the directory,
stems from a script that a colleague of mine wrote some years ago. The script would cd
into the directory, then do a find for files older than one week, and delete them; it's
purpose was to get rid of old log files for a particular app. However, I didn't know
about the script, and one day removed the directory in question. The next time the
script ran, while the cd failed, the find & remove did not fail and it began wiping out
files from / on down, crashing the system. Ever since then, I always specify full paths
in my scripts.
Petre
Les Mikesell wrote:
> On Mon, 2005-10-10 at 10:34, Sudev Barar wrote:
>
>
>>rsync -avzP -e ssh ip_of_source:/home /
>>
>>This will copy all (including sub-directories) from source to
>>destination represented by the "/" If you are sitting at source then
>>you need:
>>rsync -avzP -e ssh /home ip_of_destination:/
>>
>>man rsync for excellent information. Trailing "/" will not copy copy
>>sub-directories.
>
>
> A trailing slash on the source directory name means that it won't
> create that name below the target path. Copying subdirectories below
> is controlled by the -a or -r options. I think the path/ convention
> is confusing so I always cd into the source directory and use '.'
> as the source name and give the full path for the target. It will
> still create the last element of the path if it doesn't exist.
>
More information about the K12OSN
mailing list