summaryrefslogtreecommitdiff
path: root/extract_zips.sh
blob: ebc8c299b7acfd9a08560294584628ea13cfb035 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

if [ "x$1" = "x-j" ] ; then
    switch=-j
    shift
fi

IFS='
'

for i in $* ; do
    dir="$(basename $i .zip)"

    if [ -d "$dir" ] ; then
        echo $dir already exists
    else
        mkdir "$dir"
        cd "$dir"
        unzip $switch "../$i"
        cd ..
        rm "$i"
    fi
done