Being VERY careful while using the --delete option

Ted Gilchrist egilchri at
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


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

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.


Ted Gilchrist

"Speech, not just for humans"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the rsync mailing list