本文介绍了除了一些RM的所有文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在使用 sudo的RM -r ,我怎么可以删除所有文件,但下列除外:
TextFile.txt的backup.tar.gzscript.php的database.sql信息.txt解决方案
找到[路径]型的F - 不是-name'EXPR'-print0 | xargs的-0的RM -例如,删除当前目录中的所有非TXT的文件:
找到。型的F - 不是-name'* TXT'-print0 | xargs的-0的RM -查找| xargs的组合是非常有用的。
如果你不指定型F找到也将列出目录,你可能不希望。
When using sudo rm -r, how can I delete all files, with the exception of the following:
textfile.txt backup.tar.gz script.php database.sql info.txt解决方案 find [path] -type f -not -name 'EXPR' -print0 | xargs -0 rm --
for example, delete all non txt-files in the current directory:
find . -type f -not -name '*txt' -print0 | xargs -0 rm --The "find | xargs" combination is really useful.
If you don't specify "-type f" find will also list directories, which you may not want.
更多推荐
除了一些RM的所有文件
发布评论