Deletion of destination files

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Deletion of destination files

Rodolfo Medina
Hi to all rsync users.

rsync's `--delete' option works fine in the following example: I'm sending all
the content of /home/rodolfo from machine1 to /home/rodolfo in machine2:

 $ rsync --dry-run -vrtul --delete --exclude='/.*' . 192.168.0.2:/home/rodolfo

, and --delete works perfectly.  Instead, in this other example:

 $ rsync --dry-run -vrt --delete --modify-window=1 file1 file2 file3
... /mnt/pendrive/rodolfo

I'm copying various files and directories from different places of my home
directory to a directory named `rodolfo' which is on the pendrive.  I want that
all the files that are not listed among `file1 file2 file3 ...' in the above
command were deleted in the destination, but this does not happen.  In rsync
`man' page I can't find a solution.  Please, whoever can, any suggestion about
how to do what I want.

Thanks in advance for any help,

Rodolfo


--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Reply | Threaded
Open this post in threaded view
|

Re: Deletion of destination files

Steven Levine
In <[hidden email]>, on 06/05/16
   at 10:40 AM, Rodolfo Medina <[hidden email]> said:

Hi Rodolfo,

> $ 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.

It comes up so often on the list that this should be a FAQ.

Check out

  --itemize-changes

It is almost always the best solution for understanding why rsync is
processing a given file a certain way.  --verbose is typically more
helpful when diagnosing problems with complex filters and other obscure
problems.


Steven

--
----------------------------------------------------------------------
"Steven Levine" <[hidden email]>  Warp/DIY/BlueLion etc.
www.scoug.com www.arcanoae.com www.warpcave.com
----------------------------------------------------------------------


--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Reply | Threaded
Open this post in threaded view
|

Re: Deletion of destination files

Rodolfo Medina
"Steven Levine" <[hidden email]> writes:

> In <[hidden email]>, on 06/05/16
>    at 10:40 AM, Rodolfo Medina <[hidden email]> said:
>
> Hi Rodolfo,
>
>> $ 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.
>
> It comes up so often on the list that this should be a FAQ.
>
> Check out
>
>   --itemize-changes
>
> It is almost always the best solution for understanding why rsync is
> processing a given file a certain way.  --verbose is typically more
> helpful when diagnosing problems with complex filters and other obscure
> problems.


Thanks.  But neither the use of -i either -v shows or tells anything about the
files deleted in the sender, that remain in the destination and are are not
deleted.

Regards,

Rodolfo

--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Reply | Threaded
Open this post in threaded view
|

Re: Deletion of destination files

Kevin Korb
In reply to this post by Rodolfo Medina
See --delete-missing-args (a fairly new feature)

On 06/05/2016 06:40 AM, Rodolfo Medina wrote:

> Hi to all rsync users.
>
> rsync's `--delete' option works fine in the following example: I'm sending all
> the content of /home/rodolfo from machine1 to /home/rodolfo in machine2:
>
>  $ rsync --dry-run -vrtul --delete --exclude='/.*' . 192.168.0.2:/home/rodolfo
>
> , and --delete works perfectly.  Instead, in this other example:
>
>  $ rsync --dry-run -vrt --delete --modify-window=1 file1 file2 file3
> ... /mnt/pendrive/rodolfo
>
> I'm copying various files and directories from different places of my home
> directory to a directory named `rodolfo' which is on the pendrive.  I want that
> all the files that are not listed among `file1 file2 file3 ...' in the above
> command were deleted in the destination, but this does not happen.  In rsync
> `man' page I can't find a solution.  Please, whoever can, any suggestion about
> how to do what I want.
>
> Thanks in advance for any help,
>
> Rodolfo
>
>
--
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,
        Kevin Korb Phone:    (407) 252-6853
        Systems Administrator Internet:
        FutureQuest, Inc. [hidden email]  (work)
        Orlando, Florida [hidden email] (personal)
        Web page: http://www.sanitarium.net/
        PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,


--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Deletion of destination files

Rodolfo Medina
Kevin Korb <[hidden email]> writes:

> See --delete-missing-args (a fairly new feature)


Thanks, but unfortunately it does not work either.

Rodolfo


>
> On 06/05/2016 06:40 AM, Rodolfo Medina wrote:
>> Hi to all rsync users.
>>
>> rsync's `--delete' option works fine in the following example: I'm sending
>> all the content of /home/rodolfo from machine1 to /home/rodolfo in machine2:
>>
>>  $ rsync --dry-run -vrtul --delete --exclude='/.*' . 192.168.0.2:/home/rodolfo
>>
>> , and --delete works perfectly.  Instead, in this other example:
>>
>>  $ rsync --dry-run -vrt --delete --modify-window=1 file1 file2 file3
>> ... /mnt/pendrive/rodolfo
>>
>> I'm copying various files and directories from different places of my home
>> directory to a directory named `rodolfo' which is on the pendrive.  I want
>> that all the files that are not listed among `file1 file2 file3 ...' in the
>> above command were deleted in the destination, but this does not happen.  In
>> rsync `man' page I can't find a solution.  Please, whoever can, any
>> suggestion about how to do what I want.
>>
>> Thanks in advance for any help,
>>
>> Rodolfo

--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Reply | Threaded
Open this post in threaded view
|

Re: Deletion of destination files

Wayne Davison-2
In reply to this post by Rodolfo Medina
On Sun, Jun 5, 2016 at 6:39 AM, Steven Levine <[hidden email]> 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 -@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..


--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html