Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Delete only directories (not files) in a directory
# Make a directory with some test directories and files inside
mkdir test
cd test
mkdir test1
mkdir test2
mkdir test3
touch hello.txt
touch goodbye.txt
touch samurai.txt
# goodbye.txt hello.txt samurai.txt test1 test2 test3
# Delete the directories only
rm -r */
# goodbye.txt hello.txt samurai.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.