Created
March 29, 2012 06:26
-
-
Save ekayxu/2234127 to your computer and use it in GitHub Desktop.
压缩最后距离修改时间大于1周的文件
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd `dirname $0` | |
cd $1 | |
for f in `ls | grep -E '^'$1'_[[:digit:]]+$'` | |
do | |
modify=`date +%s -r $f` | |
weekago=`date +%s -d '-1 week'` | |
if [ $weekago -gt $modify ]; then | |
echo "Ziping file $f" | |
time bzip2 $f | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment