summaryrefslogtreecommitdiff
path: root/bin/multi_unzip
blob: 94ecd3fdb3bd716077034042eb8332ea0a137d9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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