Categories: Hostripples Featured

How to find and Delete the empty Directories And Files In UNIX !!!

The following command would help you find empty files & directory

find . -type d -empty — for directory
find . -type f -empty — for files

Delete all empty directories under the current directory using the following command :

find . -type d -empty -exec rmdir {} \;

To see the count of files users have in use the following command :

wc -l find . -type f -empty | wc -l
&
For non-empty files count :
find . -type f -not -empty | wc -l

In all the above examples replace the ( . – dot) with directory absolute path under which you would like to search the files.

Note: It is not recommended to remove empty directories from any system directories.


HR-ADMIN

Recent Posts

The Future of App Development: No-Code, Low-Code, and Traditional Coding

The app development industry is evolving at an incredible pace. A decade ago, creating an application required extensive programming knowledge,…

2 weeks ago

Why You Should Move Your Website to Cloud Hosting?

Introduction to Cloud Hosting In today's digital world, website performance can make or break an online business. Whether you run…

1 month ago

What is a Call to Action in Marketing? Definition + Examples

In the world of digital marketing, getting attention is only half the battle. The real goal is to convince people…

2 months ago

Website Bandwidth: What it is and Why it Matters?

Introduction In today's digital world, understanding website bandwidth is essential for anyone running a website. Whether you own a blog,…

2 months ago

Will AI Replace Developers in the Future?

Artificial intelligence is changing the tech world at lightning speed. From automated chatbots to AI-generated applications, many people are now…

2 months ago