My structure is as follows:
├── Proj 1
│ ├── .git
│ ├── LICENSE
│ ├── README.md
│ └── example.cpp
├── Proj 2
│ ├── .git
│ ├── root_folder
│ └── README.md
├── Proj 3
│ ├── .git
│ ├── root_folder
│ └── README.md
...
Why is it when I do a rm -ri \\.git
it says:
rm: cannot remove `.git': No such file or directory
you could try
rm -ri */.git
(not sure that's what you want)
The semantics of rm
's recursive search are not right for finding and deleting directories below the current one. The -ri
flag will probably show each file beneath the .git
folder right?
Happily if you are using bash
, a one-liner with find
will do what you need:
find . -name .git -type d -exec bash -c 'read -p "$0: Delete? " -n 1 -r && echo "" && case $REPLY in y) rm -rf "$0" ;; esac' {} \; -prune
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.