From 722a3896b4c0c66abb5358437fb9a5a484ec75ae Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Wed, 27 Mar 2013 13:42:36 +0100 Subject: [PATCH] remove obsolete (renamed) files --- atom | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/atom b/atom index 42a6b4e..e847af5 100755 --- a/atom +++ b/atom @@ -2090,6 +2090,7 @@ do "- $((taskcount - remaining)) of $taskcount ($failed failed)" \ "${days}d ${hours}h${minutes}m " done +unset count endtime=$(date +%s) @@ -2118,6 +2119,31 @@ endtime=$(date +%s) echo -e "\rRan $taskcount tasks, $failed of which failed, in $days" \ "days, $hours hours, $minutes minutes and $seconds seconds." +echo ' + SELECT id, + old_filename + FROM destination_files + WHERE old_filename IS NOT NULL; + + SELECT "AtOM:NoMoreFiles"; +' >&3 + +echo "Removing obsolete files... " +read -u4 line +while [[ $line != AtOM:NoMoreFiles ]] +do + id=${line%%|*} + filename=${line#*|} + if [ -f "$filename" ] + then + rm -f "$filename" + fi + Update destination_files old_filename NULL <<<"id = $id" + progressSpin + read -u4 line +done +echo $'\r'"Removed ${count:-0} obsolete files." + echo "Purging empty directories." for path in "${destinationpath[@]}" do