使用问答

linux和shell

当前位置: 首页 -> 使用问答 -> linux和shell -> 正文

我的系统怎么了(五)删除大量文件提示参数过长解决办法

信息来源: 发布日期:2019-12-11

linux下删除大量文件提示参数过长解决办法

比如:

[root@login12 test2]# rm -rf *

-bash: /usr/bin/rm: Argument list too long

下面这个使用rsync删除最快:几秒吧,但是容易出错,自己注意下。

[root@cqb new]# cd /root/Maildir/new/ ###切记啊,到当前目录!!!!!

[root@cqb new]# mkdir blanktest

[root@cqb new]# rsync -a --delete blanktest/.

注意后面有个点哦

下面这个find这个需要:龙龙time

[root@cqb new]# find ./ -type f -exec rm {} \;

下面这个这个大约10分钟--感觉还是这个保险啊

[root@cqb new]#find ./ -type f -delete ###切记啊,到当前目录--这个还好些!!!!!

下面这个大约10分钟,这个感觉好危险啊!

[root@login12 test2]# cd /lustre3/chenfj/soft_tar/tar3/test2 ###切记啊,到当前目录!!!!!

[root@cqb new]#perl -e 'for(< *>){((stat)[9]< (unlink))}'