Getting --delete to work, simply

Mike Brown brown at mrvideo.vidiot.com
Thu May 3 04:08:37 UTC 2018


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
-- 
e-mail: vidiot at vidiot.com | vidiot at vidiot.net            /~\ The ASCII
        6082066843 at email.uscc.net (140 char limit)       \ / Ribbon Campaign
Visit - URL: http://vidiot.com/                           X  Against
             http://vidiot.net/                          / \ HTML Email
"What do you say Beckett. Wanna have a baby?" - Castle to Det. Beckett
"How long have I been gone?" Alexis after seeing Castle and Beckett w/ baby
 - Castle - 11/25/13



More information about the rsync mailing list