Praj's Blog

rmdir with -p

You might already know about this one, but if not, rmdir has a -p option like mkdir which allows it to recurse into any child folders and remove them as well if they are empty (it will throw an error if not empty). Handy if you have a folder structure a few levels deep that is empty and want to quickly remove all the folders in one hit. By the way if you didn’t know about mkdir -p it will let you create directories recursively as many levels deep as you need e.g. mkdir -p level1\level2\level3