From d04b760ed7484f0c00c65d21659de0c7b90da590 Mon Sep 17 00:00:00 2001 From: tianyu Date: Sun, 11 Jan 2015 12:25:09 +0800 Subject: [PATCH] Create d2z.sh --- d2z.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 d2z.sh diff --git a/d2z.sh b/d2z.sh new file mode 100644 index 0000000..68045ae --- /dev/null +++ b/d2z.sh @@ -0,0 +1,14 @@ +#!/bin/bash +#============================================================================== + +check_sub(){ + SAVEIFS=$IFS # setup this case the space char in file name. + IFS=$(echo -en "\n\b") + for subdir in $(find -maxdepth 1 -type d |grep ./ |cut -c 3-); + do + echo $subdir + zip -r -0 "$subdir.zip" "$subdir" + done + IFS=$SAVEIFS +} +check_sub