[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: rsync --delete



Mike McClain wrote on 10/16/20 4:09 PM:
> I've been using rsync to backup to a flash drive but it's not
> performing exactly as I expected.
> 
> The man page says:
>     --delete                delete extraneous files from dest dirs
> A section of the backup script is so:
> Params=(-a --inplace --delete);
> Flash=/sda/rpi4b
> cd /home/mike
> [ ! -d $Flash/mike ] && mkdir $Flash/mike;
> 
> #   exclude compressed files and the contents of most of the .* directories
> /mc/bin/mk_rsync_exclude.sh
> echo /usr/bin/rsync $Params --exclude-from=/home/mike/.rsync_exclude . $Flash/mike
> /usr/bin/rsync $Params --exclude-from=/home/mike/.rsync_exclude . $Flash/mike ||
>     echo rsync $Params --exclude-from=/home/mike/.rsync_exclude . $Flash/mike    Failed $? ;
> 
>     If I delete a file from my home directory then backup over last
> week's copy the deleted file stays in the backup directory and these
> build up over time.
>     Am I misusing rsync or am I just not understanding how it works?

The latter :-)

You need to add:
  --delete-excluded

(I'll let you read the man page to see what that does :-) )

  Doc

-- 
Web:  http://enginehousebooks.com/drevans

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: