Timeline for Using find to look for a directory and remove its subdirectories
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 16, 2017 at 16:31 | comment | added | Centimane | @Kusalananda my mistake! | |
| May 16, 2017 at 16:30 | comment | added | Kusalananda♦ | @Centimane You are talking to the wrong person. | |
| May 16, 2017 at 16:30 | comment | added | Centimane |
Still begs the question why you didn't take the simpler: find . -type d -name "mf" -exec rm -rf {}/* \;
|
|
| May 16, 2017 at 16:29 | comment | added | Centimane |
Your example swaps mf with foo, and the directory foo was deleted.
|
|
| May 16, 2017 at 16:19 | comment | added | Kusalananda♦ |
@Centimane Only the subdirectories of the mf directories were to be deleted, not the files of the mf directories.
|
|
| May 16, 2017 at 16:11 | comment | added | Centimane |
why not just find . -type d -name "mf" -exec rm -rf {} \;? Also, in your example you use foo and bar, but your suggestion does not. The solution you propose and the example you give should be consistent.
|
|
| May 16, 2017 at 16:03 | history | answered | DopeGhoti | CC BY-SA 3.0 |