From 293511e102bb20fb42f1db1397078adbae0d5366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20V=C3=A1squez=20P=C3=A9rez?= Date: Thu, 11 Mar 2021 12:27:43 -0800 Subject: [PATCH] Added a quick script to rename files and add its 'extention' wich it extracts from the output of a 'file' command --- bash/setext.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 bash/setext.sh diff --git a/bash/setext.sh b/bash/setext.sh new file mode 100755 index 0000000..832e0dc --- /dev/null +++ b/bash/setext.sh @@ -0,0 +1,16 @@ +for i; +do + real_ext=$(file $i | cut -d':' -f2 | cut -d' ' -f2) + ##echo $ext + if [ $real_ext == "JPEG" ]; + then + ext="jpg" + elif [ $real_ext == "TIFF" ]; + then + ext="tif" + else + ext=$real_ext + fi + new_ext=${ext,,} + mv $i ${i%.*}.$new_ext +done