How to delete all files older than 3 days when “Argument list too long”?

前端 未结 3 1175
情深已故
情深已故 2020-12-22 19:07

I\'ve got a log file directory that has 82000 files and directories in it (about half and half).

I need to delete all the file and directories which are older than 3

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-22 19:42

    Another solution for the original question, esp. useful if you want to remove only SOME of the older files in a folder, would be smth like this:

    find . -name "*.sess" -mtime +100 
    

    and so on.. Quotes block shell wildcards, thus allowing you to "find" millions of files :)

提交回复
热议问题