开发者

SSH/Shell - Remove all folders with name "____" within folder AND subfolders

开发者 https://www.devze.com 2023-01-03 05:33 出处:网络
I have a script that is copying a folder that contains a couple sub folders. The original that it is copying from is part of an SVN folder, so it is copying th开发者_StackOverflow中文版ose \".svn\" fo

I have a script that is copying a folder that contains a couple sub folders. The original that it is copying from is part of an SVN folder, so it is copying th开发者_StackOverflow中文版ose ".svn" folders as well.

I want to remove those from the new destination, my best guess was:

rm -Rf dir/*.svn

Which doesn't work, is there a way to do this or do I need to manually go into each folder to delete it?


From within the folder whose contents you want to filter:

find . -name '.svn' -print0 | xargs -0 rm -rf

or

find . -name '.svn' -exec rm -rf {} \;


Take a look at this: http://snippets.dzone.com/posts/show/2486

0

精彩评论

暂无评论...
验证码 换一张
取 消