shell脚本-批量清理文件夹

shell脚本批量自动清理linux文件夹,释放磁盘空间

#!/bin/bash
source /etc/profile

cd /file_path

echo `date '+%Y-%m-%d %H:%M:%S'`" sftp dir clean start"
echo "+++++++++++++++++++++++++++++++++++++++++++++++++"
for account in `cat /~/path.list`
do
    time1=$[$(date +%s%N)/1000000] 
    file_count=`find /$account -type f -mtime +60 |wc -l`
    find /NSFTP/$account/download/ -type f -mtime +60 |xargs -n 10 rm -rf
    time2=$[$(date +%s%N)/1000000] 
    echo $account "delete" $file_count "files, cost "$[$time2-$time1]"ms."
done

echo "+++++++++++++++++++++++++++++++++++++++++++++++++"
echo `date '+%Y-%m-%d %H:%M:%S'`" sftp dir clean end"
echo ""

猜你喜欢

转载自blog.csdn.net/u013240609/article/details/126430395