Argument list too long error for rm, cp, mv commands

前端 未结 27 2807
长情又很酷
长情又很酷 2020-11-22 04:50

I have several hundred PDFs under a directory in UNIX. The names of the PDFs are really long (approx. 60 chars).

When I try to delete all PDFs together using the fol

27条回答
  •  无人共我
    2020-11-22 05:28

    I had the same problem with a folder full of temporary images that was growing day by day and this command helped me to clear the folder

    find . -name "*.png" -mtime +50 -exec rm {} \;
    

    The difference with the other commands is the mtime parameter that will take only the files older than X days (in the example 50 days)

    Using that multiple times, decreasing on every execution the day range, I was able to remove all the unnecessary files

提交回复
热议问题