Deletion of destination files

Wayne Davison wayned at samba.org
Sun Jun 5 23:55:49 UTC 2016


On Sun, Jun 5, 2016 at 6:39 AM, Steven Levine <steve53 at earthlink.net> wrote:

> > $ rsync --dry-run -vrt --delete --modify-window=1 file1 file2 file3 ...
> >/mnt/pendrive/rodolfo
>
> >not happen.  In rsync `man' page I can't find a solution.
>

>From the man page's description of --delete:

This tells rsync to delete extraneous files from the receiving side (ones
> that aren’t on the sending side), but only for the directories that are
> being synchronized. You must have asked rsync to send the whole directory
> (e.g. "dir" or "dir/") without using a wildcard for the directory’s
> contents (e.g. "dir/*") since the wildcard is expanded by the shell and
> rsync thus gets a request to transfer individual files, not the files’
> parent directory.


You didn't ask rsync to send a directory, so it can't do any deletions. You
should instead use filter rules to include what you want to send from a
particular directory and hide everything else (or use an exclude combined
with --delete-excluded):

rsync -aiv --del - at 1 -f'+ /file1' -f'+ /file2' -f'+ /file3' -f'H *' ./
/mnt/pendrive/rodolfo

You could also combine all the filter rules into a single file and tell
rsync to read that instead of specifying them all on the command-line.

..wayne..
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/rsync/attachments/20160605/2d26ffd4/attachment.html>


More information about the rsync mailing list