Created
August 18, 2019 12:46
-
-
Save hrules6872/ae9d40d0363db056eebdb561b485dab3 to your computer and use it in GitHub Desktop.
Delete all Darktable rejected and low-rated pictures
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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