Bash(Linux) Shell Script to zip the files older than 30 days
**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}"
精彩评论