Answers to: rsync with --delete optionhttp://linuxexchange.org/questions/244/rsync-with-delete-option<p>Anyone know why:</p> <pre><code>rsync -azuv --exclude "*.db" --delete /etc/postfix/ /home/backups/system/etc/postfix/ </code></pre> <p>Would delete files from the destination that don't exist on the source (as it is supposed to), but:</p> <pre><code>rsync -azuv --exclude "*.db" --delete /etc/postfix/* /home/backups/system/etc/postfix/ </code></pre> <p>Doesn't?</p> <p>There is nothing "funky" about the files (as far as I can tell) that don't get delete by the second command - in other words, they don't start with a "." or anything. For the record (not that it matters) the files that weren't removed from the destination after I deleted them from the source were:</p> <p>postgrey_whitelist_recipients.rpmnew postgrey_whitelist_clients.rpmnew postgrey_whitelist_clients.local.rpmnew</p> <p>TIA!</p>enThu, 06 May 2010 17:10:55 -0400Answer by daniel.hahler.dehttp://linuxexchange.org/questions/244/rsync-with-delete-option/336<p>--delete does not appear to take any arguments: it's just a switch!</p> <p>However, using "/etc/postfix/*" on the shell (without the quotes) will get expanded (by the shell) to all files in /etc/postfix, therefore you're basically passing a list of existing source files (and not a directory to "compare").</p> <p>You want to just pass the directory only.</p>daniel.hahler.deThu, 06 May 2010 17:10:55 -0400http://linuxexchange.org/questions/244/rsync-with-delete-option/336Answer by feinomhttp://linuxexchange.org/questions/244/rsync-with-delete-option/245<p>From the man page:</p> <blockquote> <p>--delete delete extraneous files from dest dirs</p> </blockquote> <p>As we can see, it expects you to pass the directory containing the files (/path/to/directory/) - not the files themselves (/path/to/directory/*).</p>feinomTue, 04 May 2010 04:28:41 -0400http://linuxexchange.org/questions/244/rsync-with-delete-option/245