Skip to content

Instantly share code, notes, and snippets.

@dcoppari
Created August 15, 2017 11:19
Show Gist options
  • Save dcoppari/47d5cdcdd5869c8d5fbebae3eb6c4ab7 to your computer and use it in GitHub Desktop.
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
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