[英]Linux Shell - Delete a folder whose name startwith .git which is a part of inner folders
here is a sample directory structure/tree 这是示例目录结构/树
main_directory-|- folder1
|- folder2
|- folder3
|- folder4 -|- .git
|- my_project
|- some_other_files
assume I'm in the main directory. 假设我在主目录中。
admin@admin:~/$ cd main_directory
admin@admin:~/main_directory$
here I want to execute some command which will delete all folders whose name starts with .git
RECURSIVELY. 在这里,我想执行一些命令,该命令将删除名称以
.git
RECURSIVELY开头的所有文件夹。
What I was trying = rm -r .git*
its not working. 我正在尝试=
rm -r .git*
它不起作用。 or may be using someother command, eg mv
but I dont have any clue about that. 或可能正在使用其他命令,例如
mv
但我对此没有任何线索。
problem is I have many such folders and each of them has one or more .git
so I cannot go manually in each directory and delete git folder. 问题是我有很多这样的文件夹,并且每个文件夹都有一个或多个
.git
所以我无法手动进入每个目录并删除git文件夹。
find . -name .git -exec rm -r {} \\;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.