From 9954d86b6eb813bc296148d75a5b074cc2247800 Mon Sep 17 00:00:00 2001 From: tianyu Date: Sun, 21 Dec 2014 17:31:00 +0800 Subject: [PATCH] Create d2t.sh --- d2t.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 d2t.sh diff --git a/d2t.sh b/d2t.sh new file mode 100644 index 0000000..f734da8 --- /dev/null +++ b/d2t.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 + tar cf "$subdir.tar" "$subdir" + done + IFS=$SAVEIFS +} +check_sub