Created
December 10, 2016 08:49
-
-
Save touren/7a3fdbea26b0012cc2b867c630d1ada9 to your computer and use it in GitHub Desktop.
append postfix to files by checking it's content.
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
for f in `ls` | |
do | |
xxd -l 16 $f > xxd_result | |
if grep -q Exif xxd_result; then | |
echo $f.jpg | |
mv $f $f.jpg | |
else | |
if grep -q ftypqt xxd_result; then | |
echo $f.mov | |
mv $f $f.mov | |
else | |
echo $f UNKNOWN | |
fi | |
fi | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment