命令行递归删除匹配的文件和目录
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了命令行递归删除匹配的文件和目录相关的知识,希望对你有一定的参考价值。
# This searches recursively for all directories (-type d) in the hierarchy starting at "." (current directory), and finds those whose name is '.svn'; the list of the found directories is then fed to rm -rf for removal. find . -name '.svn' -type d | xargs rm -rf # If you want to try it out, try find . -name '.svn' -type d | xargs echo # This should provide you with a list of all the directories which would be recursively deleted. ================================== # Another way is: find . -name ".svn" -exec rm -rf {} ; #Try something like this first to do a dry run: find . -name ".svn" -exec echo {} ; #Note that the empty braces get filled in with the file names and the escaped semicolon ends the command that is executed (starting after the "-exec").
以上是关于命令行递归删除匹配的文件和目录的主要内容,如果未能解决你的问题,请参考以下文章