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

前端 未结 3 1161
情深已故
情深已故 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:31

    To delete all files and directories within the current directory:

    find . -mtime +3 | xargs rm -Rf
    

    Or alternatively, more in line with the OP's original command:

    find . -mtime +3 -exec rm -Rf -- {} \;
    

提交回复
热议问题