vi .bashrc
# .bashrc
# User specific aliases and functions
alias rm=trash
alias cp=‘cp -i‘
alias mv=‘mv -i‘
alias r="rm -i"
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
trash()
{
MYVAR=$@
mv ${MYVAR#-* } /recycle
}
附加一个定时清理回收站脚本
import os
def removeDir(dirPath):
if not os.path.isdir(dirPath):
return
files = os.listdir(dirPath)
try:
for file in files:
filePath = os.path.join(dirPath, file)
if os.path.isfile(filePath):
os.remove(filePath)
elif os.path.isdir(filePath):
os.rmdir(filePath)
#os.rmdir(dirPath)
except Exception, e:
print e
removeDir(r‘/recycle/‘)
crontab 添加
0 23 * * 6 python /clear.py
原文:http://www.cnblogs.com/huangjianan/p/4364998.html