Rsync unexpectedly removing ALL files

Koehn, Troy N. TNKoehn at west.com
Thu Jun 2 17:11:12 UTC 2016


I am using rsync with --files-from option with a file named 'rsync.in' that contains 37K+ directories that are queried from a database. One of the directories looked like this:

/home/usr/directory/./

I know the directory should NOT end with a './' but this was stored in the database that way by another process. When performing the rsync, this one directory caused all files from the root '/' directory on down to be deleted. However, if ran without the --files-from option it works as expected. It is because of the './' on the end and using the 'files-from' option but I don't know why rsync would do that.

Obviously not allowing these directories to be stored in the database in the first place is the thing to do, but I just want to understand why rsync would do this so I can ensure I prevent things like this in the future. Here's the command (with the dry-run option for safety).

rsync --dry-run --perms --delete --compress --dirs --links --times --keep-dirlinks --files-from=/usr/home/rsync.in /home/src/shared/directory/ /

BTW, rsync  version 3.1.0  protocol version 31
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/rsync/attachments/20160602/99cb580f/attachment.html>


More information about the rsync mailing list