Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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