Skip to content

Instantly share code, notes, and snippets.

@touren
Created December 10, 2016 08:49
Show Gist options
  • Save touren/7a3fdbea26b0012cc2b867c630d1ada9 to your computer and use it in GitHub Desktop.
Save touren/7a3fdbea26b0012cc2b867c630d1ada9 to your computer and use it in GitHub Desktop.
append postfix to files by checking it's content.
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