删除路径的所有.svn目录与嵌入的空白 [英] Delete all .SVN folders in paths with embedded blanks
问题描述
在<一个href=\"http://stackoverflow.com/questions/5935776/how-to-delete-svn-folders-in-my-source-tree/13850323#13850323\">this问题和百等地,大多有删除所有.svn目录相同的Linux解决方案。它精美的作品,直到路径发生包括空格。那么,有没有一种技术可以递归删除的.svn文件中包含空格的目录?也许一个办法告诉发现以用引号括其答案?
In this question, and a hundred other places, there are mostly identical Linux solutions for deleting all .svn directories. It works beautifully until the paths happen to include blanks. So, is there a technique to recursively remove .svn files in directories that contain blanks? Perhaps a way to tell find to wrap its answers in quotes?
推荐答案
您可以告诉找到
来使用null作为输出分隔符,而不是换行与 -print0
的行动。
you can tell find
to use null as an output delimiter instead of newline with the -print0
action.
,那么你可以告诉的xargs
使用null作为与 -0
参数输入分隔符。
then you can tell xargs
to use null as an input delimiter with the -0
argument.
例如:
find . -name '*.svn' -print0 | xargs -0 -I{} rm \'{}\'
在 -I {}
参数xargs的告诉它来代替 {}
从标准输入当前行。并亲自,我喜欢包括反斜线周围的文件名引号为好,只是为了以防万一。
the -I{}
argument to xargs tells it to replace {}
with the current line from standard input. and personally, i like to include the backslash escaped quotes around the filenames as well, just to be doubly sure.
这篇关于删除路径的所有.svn目录与嵌入的空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!