Getting --delete to work, simply

Kevin Korb kmk at
Thu May 3 05:09:30 UTC 2018

--delete only works when you sync a dir not individual files.  So...
rsync -vai --delete --include='g*' --include='G*' --exclude='*'
/share/Public/videos/ /share/Backup-HDD-03

On 05/03/2018 12:08 AM, Mike Brown via rsync wrote:
> rsync  version 3.1.2  protocol version 31
> I've run into an issue using rsync on my QNAP NAS.  I've installed Entware-ng
> on the NAS so that I can install better versions of programs, rsync being
> one of them.
> But, I've run into an issue wqith using the --delete option, as it has
> problems using wildcards.
> Initially a backup script looked like:
> #!/bin/sh
> for d in /share/Public/videos/[Gg]*
> do
> rsync -av --delete $d /share/Backup-HDD-03
> done
> I've discovered that any directory that starts with "A", or "a" that is on
> the backup disk that is no longer on the source disk is not getting deleted.
> In order to only back up directories/files that start with "G", or "g",
> required a script that looks like:
> #!/bin/sh
> pushd /share/Public/videos
> ls -d [0-9A-FH-Za-fh-z]* > /share/homes/admin/bin/backup_exclude_list
> echo "lost+found" >> /share/homes/admin/bin/backup_exclude_list
> for d in .
> do
> rsync -av --delete --exclude-from=/share/homes/admin/bin/backup_exclude_list \
> $d /share/Backup-HDD-03
> done
> popd
> There has to be a much simplier script, or is this really it?
> Thanks for any tips.
> MB

	Kevin Korb			Phone:    (407) 252-6853
	Systems Administrator		Internet:
	FutureQuest, Inc.		Kevin at  (work)
	Orlando, Florida		kmk at (personal)
	Web page:
	PGP public key available on web site.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the rsync mailing list