Locate Empty Directories from Command Line

As a software engineer that lives too much of his life on a computer, I like keeping my machine as clean as possible. I don’t keep rogue downloaded files and removes apps when I don’t need them. Part of keeping a clean, performant system is removing empty directories. To identify empty directories, I use the […]

The post Locate Empty Directories from Command Line appeared first on David Walsh Blog.


This content originally appeared on David Walsh Blog and was authored by David Walsh

As a software engineer that lives too much of his life on a computer, I like keeping my machine as clean as possible. I don’t keep rogue downloaded files and removes apps when I don’t need them. Part of keeping a clean, performant system is removing empty directories.

To identify empty directories, I use the following command:

find . -type d --empty

To remove empty directories, we can add a --delete flag:

find . -type d --empty --delete

Keeping a clean machine is easy when you know the tools that can help you. find makes identifying and eliminating easy, so don’t be afraid to use it!

The post Locate Empty Directories from Command Line appeared first on David Walsh Blog.


This content originally appeared on David Walsh Blog and was authored by David Walsh


Print Share Comment Cite Upload Translate Updates
APA

David Walsh | Sciencx (2022-11-01T10:26:52+00:00) Locate Empty Directories from Command Line. Retrieved from https://www.scien.cx/2022/11/01/locate-empty-directories-from-command-line/

MLA
" » Locate Empty Directories from Command Line." David Walsh | Sciencx - Tuesday November 1, 2022, https://www.scien.cx/2022/11/01/locate-empty-directories-from-command-line/
HARVARD
David Walsh | Sciencx Tuesday November 1, 2022 » Locate Empty Directories from Command Line., viewed ,<https://www.scien.cx/2022/11/01/locate-empty-directories-from-command-line/>
VANCOUVER
David Walsh | Sciencx - » Locate Empty Directories from Command Line. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/11/01/locate-empty-directories-from-command-line/
CHICAGO
" » Locate Empty Directories from Command Line." David Walsh | Sciencx - Accessed . https://www.scien.cx/2022/11/01/locate-empty-directories-from-command-line/
IEEE
" » Locate Empty Directories from Command Line." David Walsh | Sciencx [Online]. Available: https://www.scien.cx/2022/11/01/locate-empty-directories-from-command-line/. [Accessed: ]
rf:citation
» Locate Empty Directories from Command Line | David Walsh | Sciencx | https://www.scien.cx/2022/11/01/locate-empty-directories-from-command-line/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.