paulwong

一次删除10天前的文件夹的SHELL

find /path/to/base -mindepth 1 -maxdepth 1 -type d -ctime +10 | xargs rm -rf

-find: the unix command for finding files / directories / links etc.
/path/to/base/dir: the directory to start your search in.
-type d: only find directories
-ctime +10: only consider the ones with modification time older than 10 days
-exec  \;: for each such result found, do the following command in 
-rm -rf dir1 dir2 dir3 


https://stackoverflow.com/questions/13868821/shell-script-to-delete-directories-older-than-n-days

posted on 2020-07-27 10:48 paulwong 阅读(538) 评论(0)  编辑  收藏 所属分类: LINUX


只有注册用户登录后才能发表评论。


网站导航: