1 #tar xz targzs to destination
5 [ ! -d "$DIR" ] && echo "No such source directory" && exit 1
6 [ ! -d "$DIR2" ] && echo "No such destination directory" && exit 1
8 DIR2
=`cd "$DIR2" && pwd -P`
9 [ "$?" != 0 ] && echo "Cannot change to destination directory" && exit 1
12 [ "$?" != 0 ] && echo "Cannot change to source directory" && exit 1
14 ls *.
tar.gz
2> /dev
/null | \
15 while read targz_file
; do
16 tar xzf
"$targz_file" -C "$DIR2" 2> /dev
/null
18 #2 return code (value) (error) eg.: overwriting an existing directory with symbolic link
19 if [ "$retval" = 2 ]; then
20 tar tzf
"$targz_file" |
grep -v "/$" | \
22 #[ -d "$DIR2"/"$file" -a ! -L "$DIR2"/"$file" ] && echo "$file"
23 [ -d "$DIR2"/"$file" -a ! -L "$DIR2"/"$file" ] && rm -rf "$DIR2"/"$file"
25 tar xzf
"$targz_file" -C "$DIR2" 2> /dev
/null