Timeline for Linux command to delete all files except .git folder?
Current License: CC BY-SA 4.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 29, 2022 at 19:26 | history | edited | cincodenada | CC BY-SA 4.0 | deleted 69 characters in body |
| Sep 26, 2017 at 19:32 | comment | added | Daniel F | Good answer. When replacing -path "./.git/*" with -path "*/.git/*" then it works for excluding multiple git repositories which are under one common directory. Like projects/project1/.git and projects/project2/.git then this can be run directly inside the projects/ directory. | |
| Mar 17, 2014 at 18:29 | comment | added | cincodenada | The major difference between this and the accepted answer is not the quotes (I have those to protect from shells trying to prematurely expand the glob), but the -prune. It's a different way of accomplishing the same task. And as for the first line: any time you are running a find -delete, you should run it without the -delete first, to make sure you're not doing something unintended. | |
| Mar 12, 2014 at 3:11 | comment | added | Eric Steinborn | So this works just fine, I feel that the non quoted version was more widely accepted as the correct answer. | |
| Mar 12, 2014 at 1:27 | comment | added | Eric Steinborn | Answered my own question, no. | |
| Mar 12, 2014 at 1:25 | comment | added | Eric Steinborn | Does this require the first line to run? | |
| Mar 12, 2014 at 1:12 | history | edited | cincodenada | CC BY-SA 3.0 | added 166 characters in body |
| Mar 12, 2014 at 1:04 | history | answered | cincodenada | CC BY-SA 3.0 |