Skip to content

Instantly share code, notes, and snippets.

@hrules6872
Created August 18, 2019 12:46
Show Gist options
  • Save hrules6872/ae9d40d0363db056eebdb561b485dab3 to your computer and use it in GitHub Desktop.
Save hrules6872/ae9d40d0363db056eebdb561b485dab3 to your computer and use it in GitHub Desktop.
Delete all Darktable rejected and low-rated pictures
#!/bin/sh
if [ -z "$1" ]; then
echo Delete all Darktable rejected pictures
echo
echo "Usage:"
echo $0 [source] --onestar to delete also all pictures with one star rating
exit 1
fi
function searchAndDestroy() {
for file in $1/*.xmp;
do
if grep -lq Rating=\"$2\" $file; then
echo $file
rm ${file%.xmp} 2> /dev/null
rm $file
fi
done
}
echo "-- Deleting rejected pictures..."
searchAndDestroy $1 -1
if [[ "$*" == *--onestar* ]]; then
echo "-- Deleting low-rated pictures..."
searchAndDestroy $1 1
fi
echo "-- Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment