#!/bin/bash
Src_Path=/data/www/logs
Dst_Path=/data/www/logs_bak
for rfile in `find $Src_Path/ -depth -maxdepth 1 -type f |awk -F '/' '{print $NF}'`
do
tar -zcPvf $Dst_Path/$rfile.tar.gz $Src_Path/$rfile
done
for dir in `find $Src_Path/* -type d|awk -F '/' '{print $NF}'`
do
mkdir -p $Dst_Path/$dir
for file in `find $Src_Path/$dir/ -type f|awk -F '/' '{print $NF}'`
do
tar -zcPvf $Dst_Path/$dir/$file.tar.gz $Src_Path/$dir/$file
done
done
网友评论