Full Stack LAMP - MEAN Developer, Python developer. Certified Azure Developer. Freelance programmer/consultant/trainer.

Search for Empty Directories from Command Line

Locating and removing empty directories is easy with the find command. Below are the two simple commands to find and delete empty folders from your system.

To find empty directories, you can use the following command:

find . -type d -empty

To delete empty directories, you can add a --delete flag:

find . -type d -empty -delete

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.