Being VERY careful while using the --delete option

Ted Gilchrist egilchri at gmail.com
Tue May 10 08:51:49 MDT 2011


On UNIX, I am  executing an rsync command, from within a script. The command
goes something like this:

/usr/bin/rsync --verbose  --progress --stats --compress --recursive --times
--perms --links  --safe-links source_dir/
user at target_machine:/parent_path/source_dir


In other words, I am replicating source_dir on a remote machine. It ends up
next to a lot of sibling, directories, like this:

On target_machine

/parent_path/source_dir
/parent_path/source_dir2
....
/parrent_path/source_dirn

Here's my issue. I'd like to use the --delete option in the command above.
However, I wake up in a cold sweat worrying about supplying the empty
string for source_dir, and thus removing souce_dir, and all it's siblings on
target_machine.

Now I realize, I can just be extra careful that the variable pointing to
source_string is never empty, but I would like to have other fail safe
mechanisms in place.

I hope I have been sufficiently specific to elicit some suggestions. I guess
I am looking for the software equivalent of lots of padlocks on the
apartment door.

Thanks,

Ted Gilchrist

-- 
"Speech, not just for humans"

http://www.google.com/profiles/egilchri
about.me/ted.gilchrist
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/rsync/attachments/20110510/94c3a646/attachment.html>


More information about the rsync mailing list