开发者

Bash(Linux) Shell Script to zip the files older than 30 days

开发者 https://www.devze.com 2023-03-03 05:00 出处:网络
**Search for *.aud files in a directory for past 30 days and zip it; remove all those files after successful zip

**Search for *.aud files in a directory for past 30 days and zip it; remove all those files after successful zip

I used following but it is not removing the files after zip

find . -mtime -30 | xargs tar --no-recursion -czf Audit_Mar_2011.开发者_开发知识库tgz **


#!/bin.bash
#quick and dirty:
FILES=`find . -mtime -30 | xargs`
tar --no-recursion -czf Audit_Mar_2011.tgz "${FILES}"
rm -rf "${FILES}"
0

精彩评论

暂无评论...
验证码 换一张
取 消