rsync and the trailing slash

There may be no better piece of software in general use today than rsync. It is the heat. Without it, it would be practically impossible to backup data.

Full stop.

But.

I don’t think I will ever figure out what to do about the trailing slash. If you read the man page you will see that

rsync (options) src dest

results in a copy of src being put in dest, but

rsync (options) src/ dest

results in copies of the contents of src being put in dest.

This is actually pretty cool. Except that bash’s tab-completion slaps a trailing slash at the end of any directory, so if you’re backing up foo/ and bar/ you have to be extra-careful that you don’t make a mess of things.

(Or I supposed you could put

set mark-directories off

in your .inputrc file.)

Leave a Reply