-
-
Save undavide/ecc5c60c747b5bc36380a1c5e9cd192f to your computer and use it in GitHub Desktop.
Find corrupted files using GM identify
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
folderToCheck='/Volumes/16TB/whatever/path' | |
outputFile=~/Desktop/FileIntegrity.log | |
counter=1 | |
Red="\033[0;31m" # Red | |
Green="\033[0;32m" # Green | |
Color_Off="\033[0m" # Text Reset | |
cd "${folderToCheck}" | |
# Find all files and get count | |
count=$(find "$(pwd)" -type f -iname "*.psd" -o -iname "*.psb" | wc -l | xargs) # Optional count | |
# Find all files and iterate through all | |
find "$(pwd)" -type f -iname "*.psd" -o -iname "*.psb" | while read -r line ; do | |
result=$(identify "${line}") | |
if [ "$result" ] ; then | |
echo -e "OK $line" >> $outputFile | |
status="${Green}" | |
else | |
echo -e "ERROR $line" >> $outputFile | |
status="${Red}" | |
fi | |
echo -e "${status} File ${counter} of ${count}${Color_Off} → ${line##*/}" | |
counter=$(( $counter + 1 )) | |
done | |
echo "Wrote file ${outputFile}" | |
echo "-------------- DONE --------------" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment