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 in the database actually looked like this: /home/usr/directory/./ Probably some sort of typo when the directory was entered. When performing the rsync command below, this one directory caused all files on the destination server to be deleted from the root '/' directory on down. Obviously I have put in safeguards now to filter invalidly formatted directories, but I want to understand why rsync would do this in case there are other things I should be looking for. BTW, it only seems to happen if using the -files-from option. If ran manually from the command line it does not delete all files. I have searched the web and can find no one else who has experienced this. Note: If you test this, please use the -dry-run option rsync --dry-run --perms --delete --compress --dirs --links --times --keep-dirlinks --files-from=rsync.in source_machine:/home/src/shared/directory/ / Thanks for any assistance. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20160606/9a069743/attachment.html>
On Mon, Jun 6, 2016 at 8:52 AM, Koehn, Troy N. <TNKoehn at west.com> wrote:> One of the directories in the database actually looked like this: > > > > /home/usr/directory/./ >In the manpage under the "--relative" option (which is implied by --files-from) there is this information: It is also possible to limit the amount of path information that is sent as implied directories for each path you specify. With a modern rsync on the sending side (beginning with 2.6.7), you can insert a dot and a slash into the source path, like this: rsync -avR /foo/./bar/baz.c remote:/tmp/ That would create /tmp/bar/baz.c on the remote machine. (Note that the dot must be followed by a slash, so "/foo/." would not be abbreviated.) Thus, your path tells rsync to take the contents of the /home/usr/directory path and send its contents without any implied directories, which puts its content at the root of the transfer. ..wayne..>-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.samba.org/pipermail/rsync/attachments/20160612/1907d214/attachment.html>
Apparently Analagous Threads
- Rsync unexpectedly removing ALL files
- post-delivery virus scan
- [Bug 2091] New: scp hangs while copying a large file and being executed as a background process ( with nohup )
- post-delivery virus scan
- --keep-dirlinks --delete erroneously deletes symlinks to directories