diff options
author | garhve <git@garhve.com> | 2022-12-05 19:43:39 +0800 |
---|---|---|
committer | garhve <git@garhve.com> | 2022-12-05 19:43:39 +0800 |
commit | c6bc541ab58363d783e60a007e80e9bf9e231fda (patch) | |
tree | a59c7ed0d05225c5876f3e5e919d4f6ed0c447ff /bash/extractZip.sh |
initialize
Diffstat (limited to 'bash/extractZip.sh')
-rwxr-xr-x | bash/extractZip.sh | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/bash/extractZip.sh b/bash/extractZip.sh new file mode 100755 index 0000000..b0f38d8 --- /dev/null +++ b/bash/extractZip.sh @@ -0,0 +1,43 @@ +#!/bin/zsh + +tmpDir="Files/" + +directory() { + flag="d" + cd "$1" + + for file in *.zip; do + dirName=$(getFilePath "$flag" "$file") + if [ -d "$dirName" ]; then + rm -r "$dirName" + fi + + mkdir -p "$dirName" + + tar zxf "$file" -C "$dirName" + done +} + +run() { + if [ $# -lt 1 ]; then + echo "operator: bad use" + exit 1 + + elif [ $n -eq 1 ]; then + if [ -d "$1" ]; then + directory "$@" + +# elif [ -f $1 ]; then +# files "$@" + + else + echo "$0: wrong file" + + fi + +# else +# files "$@" + fi +} + +run "$@" |