Skip to main content
8 events
when toggle format what by license comment
Nov 9, 2018 at 10:25 comment added user232326 Ok, this should work as you want: find ./myfolder -depth -mindepth 1 -maxdepth 1 -type d ! -regex '^./myfolder/test2\(/.*\)?'
Nov 9, 2018 at 9:06 comment added user232326 Excellent work!, but sorry: that will remove all files inside ./myfolder. You need a missing (IMvhO) -type d for only directories.
Nov 9, 2018 at 8:30 comment added John1024 @Isaac OK. Done. (Also, +1 for your excellent answer.)
Nov 9, 2018 at 8:24 history edited John1024 CC BY-SA 4.0
added 675 characters in body
Feb 7, 2018 at 8:35 comment added Toby Speight Alternative to -prune to leave test2/*/ subdirectories alone: return to rm -r and add -maxdepth 1.
Feb 6, 2018 at 21:18 vote accept Riju Mahna
Feb 6, 2018 at 21:08 history edited John1024 CC BY-SA 3.0
added 149 characters in body
Feb 6, 2018 at 21:03 history answered John1024 CC BY-SA 3.0