Skip to content

Instantly share code, notes, and snippets.

@ekayxu
Created March 29, 2012 06:26
Show Gist options
  • Save ekayxu/2234127 to your computer and use it in GitHub Desktop.
Save ekayxu/2234127 to your computer and use it in GitHub Desktop.
压缩最后距离修改时间大于1周的文件
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