2017-09-27 44 views
1

我有我得到了使用find/-type f -size +10M -exec ls -l {} \; 我从here如何删除文件匹配的Linux命令输出

如何删除所有这些文件此命令的文件列表?

我试图

sudo rm `find/-type f -size +10M -exec ls -l {} \;` 

,但它不工作。

另外,{} \是做什么的?在这个命令中有什么用途-exec,管道操作员不能工作?

+1

我建议你[阅读'find'手册页](http://man7.org/linux/man-pages/man1/find.1.html)。 –

+3

至于你的问题,为什么你没有为你'find'执行'rm'而不是'ls'? –

+0

@Someprogrammerdude会工作吗? – mrid

回答

0

谢谢你们,我终于得到了它与@ WORK一些程序员 - 花花公子建议:

find/-type f -size +10M -exec rm {} \; 
1

我认为应该可以在每个找到的文件上运行find运行rm,但是我无法使其正常工作。

所以这里使用一个for循环我的解决方案:

for $f in `find/-type f -size +10M`;do rm $f;done 
+2

Outch! 'find/-type f -size + 10M -exec sudo rm'{}'+' – ceving

+0

@接受'+'为我做了诀窍。当我尝试用'\;'结束命令时,它只是说“缺少参数到'-exec' – AcId

相关问题