remove obsolete (renamed) files

This commit is contained in:
Vincent Riquer 2013-03-27 13:42:36 +01:00
parent 8ce836d707
commit 722a3896b4

26
atom
View File

@ -2090,6 +2090,7 @@ do
"- $((taskcount - remaining)) of $taskcount ($failed failed)" \ "- $((taskcount - remaining)) of $taskcount ($failed failed)" \
"${days}d ${hours}h${minutes}m " "${days}d ${hours}h${minutes}m "
done done
unset count
endtime=$(date +%s) endtime=$(date +%s)
@ -2118,6 +2119,31 @@ endtime=$(date +%s)
echo -e "\rRan $taskcount tasks, $failed of which failed, in $days" \ echo -e "\rRan $taskcount tasks, $failed of which failed, in $days" \
"days, $hours hours, $minutes minutes and $seconds seconds." "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." echo "Purging empty directories."
for path in "${destinationpath[@]}" for path in "${destinationpath[@]}"
do do