aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-04-01 15:27:44 -0700
committerBryan Newbold <bnewbold@archive.org>2020-04-01 15:27:44 -0700
commit45e08a732f27e1a5f728a2f8fafb3f8eddd95251 (patch)
tree890b6aa6a79e9dd9bfcf4a47fd942af9d7955132 /bin
parent485c8b8432d839bb3cc0bd67152adda4bbf0df20 (diff)
downloadfatcat-covid19-45e08a732f27e1a5f728a2f8fafb3f8eddd95251.tar.gz
fatcat-covid19-45e08a732f27e1a5f728a2f8fafb3f8eddd95251.zip
helper for renaming files with extensions
Diffstat (limited to 'bin')
-rwxr-xr-xbin/fix_extensions.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/fix_extensions.sh b/bin/fix_extensions.sh
new file mode 100755
index 0000000..e3ddd67
--- /dev/null
+++ b/bin/fix_extensions.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+for file in $1/*; do
+ TYPE=$(file --mime-type -b "$file" | cut -f2 -d/);
+ if [[ ! $file =~ \.$TYPE ]]; then
+ mv -v "$file" "$file.$TYPE";
+ fi
+done