feat(user/bkmml):Add aif and ape extension support
[BK-2020-03.git] / unitproc / bkt-bkunzip
CommitLineData
98030ed8
SBS
1#!/bin/bash
2
3function bkunzip() {
4 # Desc: Uncompresses zip file.
5 # Depends: unzip
6 # Version: 0.0.1
7
8 for fin in "$@"; do
9 if [[ -f "$fin" && "$fin" =~ \.zip$ ]]; then
10 # Remove the file extension to create a directory name
11 dir="${fin%.*}";
12 # Create the directory if it doesn't exist
13 mkdir -p "$dir" || \
14 { echo "ERROR:Could not mkdir:$dir"; return 1; };
15 # Extract the zip file into the directory
16 unzip "$fin" -x / -d "$dir" || \
17 { echo "ERROR:Could not unzip:$fin"; return 1; };
18 else
19 echo "ERROR:Not a valid zip file:$fin" 1>&2; return 1;
20 fi;
21 done;
22}; # wrapper for unzip
23
24printf "WARNING:$0:This is a bash function definition."