Deleting all directories not files



f33dm3bits

Gold Member
Gold Supporter
Credits
7,310
Hello , is there a way to delete all the directories within a folder without deleting all the files?
I think you also want to delete all the files of those directories you want to delete?
 

f33dm3bits

Gold Member
Gold Supporter
Credits
7,310
Change to the folder where you want to delete all those directories.
Code:
find . -type d | xargs rm -rf
This searches for all directories and then removes them recursively without asking for verification.
 


Staff online


Latest posts

Top