On the Mac OS X bash command line, you can delete all directories, with the exception of one, in the following way.
If our current directory has sub-directories and we want to delete all of them except,
./really-important-do-not-delete, we can run
$ shopt -s extglob $ rm -rf !(really-important-do-not-delete) $ ls really-important-do-not-delete $
Leave a Reply