#!/bin/bash
echo "please give logs_tar_path"
read logs_tar_path
cd $logs_tar_path
for filename in `ls $logs_tar_path`; do sudo tar -zcvf $filename.tar.gz $filename &&sudo rm -f $filename; done
这是给指定月份的文件打包
#!/bin/bash
cd /home/mx/logs/funnel
for i in `ls | grep 20110[432] ` ; do tar -zcvf $i.tar.gz $i && scp $i.tar.gz 192.168.11.33:/boot/backlogs/funnel && rm -f $i.tar.gz $i ;done
超简单--目录下的文件打包
最新推荐文章于 2024-01-06 10:15:00 发布