Getting --delete to work, simply
Francis.Montagnac at inria.fr
Francis.Montagnac at inria.fr
Fri May 4 06:19:27 UTC 2018
Hi.
On Thu, 03 May 2018 15:06:14 -0500 Mike Brown via rsync wrote:
> On Thu, May 03, 2018 at 02:59:11PM -0400, Kevin Korb via rsync wrote:
>> Note that these are working because S* and s* are being applied to all
>> the dirs and files within dirs. So if you had x/Something it wouldn't
>> get copied and if you had S/else it wouldn't get copied. Maybe you want
>> to add --prune-empty-dirs and an --include='*/' so that rsync will look
>> inside of all dirs for matching files.
> All not working so when when working with the next HDD backup:
> rsync -vain --prune-empty-dirs --delete \
> --include='[T-Z]*' --include='*/' --exclude='*' \
> /share/Public/videos/ /share/Backup-HDD-05
> When run without the --prune-empty-dirs it picked up a directory starting
> with iZ, but didn't list the sub-directory and its files. With the
> --prune-empty-dirs, it was no longer listed. It should never have been listed
> in the first place as I never included "i". But, worse than that, the
> --include='*/' is causing ALL directories in /share/Public/videos/ to be
> queued up for transfer to the backup HDD.
> The filter rule is not working out in practice. For example, the following
> directories do not get copied:
> Victoria/Season-1
> Victoria/Season-2
> Why? Because the "S" in Season is getting excluded because it is not in
> the initial include rule.
Right.
> How do you get the filter rule to only look at the first part of the path
> and ignore the remaining part of the path?
You can use simply /PATTERN that will match only at the first level.
If you want also to suppress the "others" directories on the
destination you could use --delete-excluded.
Try:
rsync -vain --delete --delete-excluded \
--include='/[T-Z]*' --exclude='/*' \
/share/Public/videos/ /share/Backup-HDD-05
> This has been a real brain teaser.
Such a powerfull mechanism cannot be simple :-(
--
francis
More information about the rsync
mailing list