Getting --delete to work, simply

Kevin Korb kmk at sanitarium.net
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 FutureQuest.net  (work)
	Orlando, Florida		kmk at sanitarium.net (personal)
	Web page:			https://sanitarium.net/
	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: <http://lists.samba.org/pipermail/rsync/attachments/20180503/5bf35f4d/signature.sig>


More information about the rsync mailing list