diff options
| author | pants <niklasjo2004@gmail.com> | 2026-09-21 14:17:03 -0700 |
|---|---|---|
| committer | pants <niklasjo2004@gmail.com> | 2026-09-21 14:17:03 -0700 |
| commit | 7b21727285e50b0b050c4ddd70d07542229c5366 (patch) | |
| tree | 5d369153c5df5b41f3750d25479a68f20169c8ff /bin/multi_unzip | |
init
Diffstat (limited to 'bin/multi_unzip')
| -rwxr-xr-x | bin/multi_unzip | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/multi_unzip b/bin/multi_unzip new file mode 100755 index 0000000..94ecd3f --- /dev/null +++ b/bin/multi_unzip @@ -0,0 +1,13 @@ +#!/bin/sh + +# unzips the contents of every present zip archive into directories of the same name +# the % is used to remove the file extension (.zip). +# % matches the shortest occurence from the end. +# %% would remove all extensions (.tar.gz would be matched by %%) +# # and ## are the corresponding operators for matching at the beginning + +for file in ./*.zip; do + dir_name=${file%.*} + mkdir -p "$dir_name" + unzip -d "$dir_name" "$file" +done |
