Created
August 15, 2017 11:19
-
-
Save dcoppari/47d5cdcdd5869c8d5fbebae3eb6c4ab7 to your computer and use it in GitHub Desktop.
Use imagemagik to check for not valid media files on Wordpress upload folders
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
BASEPATH=/var/www/vhosts | |
LIST=`ls $BASEPATH -1` | |
for i in $LIST | |
do | |
FOLDER=$BASEPATH/$i/public_html/wp-content/uploads | |
RESULT=`find $FOLDER -type f -exec identify {} 2>&1 \; | grep -v 'JPEG' | grep -v 'PNG' | grep -v 'BMP' | grep -v 'PDF' | grep -v 'GIF'` | |
if [[ $RESULT -ne "" ]]; | |
then | |
echo "$i --> $RESULT" | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment