rm过多文件出错的解决

  今天删除服务器上一个cache目录,由于文件数目过多,rm一直报错失败。rm好像是先把文件遍历一次再删除,这个目录文件超过2w,所以一直报错。现解决方案如下:

#ls >filelist
#vim filelist
:g/^/s//rm /g
:wq
#chmod 755 filelist
#./filelist

  实际效果很不错,不知道还有更好的办法吗?

7 Responses to “rm过多文件出错的解决”

Leave a Reply to netcasper

Note: Commenter is allowed to use '@User+blank' to automatically notify your reply to other commenter. e.g, if ABC is one of commenter of this post, then write '@ABC '(exclude ') will automatically send your comment to ABC. Using '@all ' to notify all previous commenters. Be sure that the value of User should exactly match with commenter's name (case sensitive).