On Fri May 10 08:16:32 2024 "Robert B. Carleton" <r...@rbcarleton.net> wrote: > I'm going to try using pax(1) in copy mode (-rw) as an alternative to > rsync and cpio when it's local filesystems. I hadn't considered that > until recently.
This is my dirty solution to add pax a "delete on target" functionality. I save the list of the files and directories I want to back up to a file (starting from my $HOME). Notice that directories end with a slash (to facilitate filtering with grep in the script.) ---------------------------- # backup_list .Xdefaults .kshrc .nexrc .profile .calendar/ .config/feh/ .config/fontconfig/ .config/gtk-3.0/gtk.css Documents/ Pictures/ [...] ------------------------------- Then I do something like this (simplified for clartiy): ---------------------------------------------- backup_list=/path/to/backup_list source=$HOME target=$device files=$(egrep -v "^$|^#" $backup_list) pax -rw -v -Z -Y $files $target # Delete files not present in source from target directory date=$(date +%H%M%S) delete_list=/tmp/delete_$date source_list=/tmp/source_$date target_list=/tmp/target_$date dirs=$(echo "$files" | grep '/$') for i in $dirs ; do find $source/$i | sed 's#'$source'##' | sort | uniq > $source_list find $target/$i | sed 's#'$target'##' | sort | uniq > $target_list diff $source_list $target_list |\ awk '/^> / { print "'$target'" $NF }' >> $delete_list done cat $delete_list | sed 's/^/delete /' rm -rf $(cat $delete_list | xargs) rm $source_list $target_list $delete_list ------------------------------------------------ -- Walter Using my patched version of OpenBSD mail(1). https://en.roquesor.com/Downloads/mail_patches.tar.gz