samedi 27 décembre 2014

How to check the file type in a script


I want to do a loop for all the images in a directory. The images doesn't have extension so I have to read the first bytes of the image to know its type. The loop should end up being something like.



for file in *
do
if [ file --mime-type -b ]
then
***
fi
done


Aucun commentaire:

Enregistrer un commentaire