Forked from hector6872/delete-darktable-rejected.sh
Created
January 20, 2021 19:48
-
-
Save Snuggle/fa1c822cc7b9da5e6d01aa3e4a7753e4 to your computer and use it in GitHub Desktop.
Delete all Darktable rejected and low-rated pictures
This file contains hidden or 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