List only empty directories and delete safely (=ask for each)

find . -type d -empty -exec rm -i -R {} \;
Will delete empty directories and sub-directories (hideen too = whose names are starting with dot .). Used 'rm' command instead of 'rmdir' to give the possibility of asking for confirmation before deleting i.e. it is not wise do delete all empty directories in /etc folder. Replace dot in 'find .' with any for other starting directory instead of current. in 'rm -i -R' 'i' stands for ask before delete and 'R' for delete folder recursively or folder itself if it is empty

By: knoppix5
2020-03-29 13:12:21

What Others Think

The article is really nice and interesting. I have searched for this type of information and would love to read this information. I hope you will share more useful articles like that. Thanks for sharing! t rex game
starjackioaz · 35 weeks and 1 day ago
I can try this command because my system is too heavy so I want to delete empty directories and make my system fast just similar to melbourne couriers same day which is the fastest parcel delivery service who departure your products on the same day.
graigalley · 34 weeks and 4 days ago
This article is really relevant to what I was trying to find. Thank you for this. I also found some video tutorials at Write My Assignment | that was also helpful for me.
jasonexpert · 20 weeks and 2 days ago
This query is run every time I also use it for deleting files and I may check the logo design price in pakistan for getting the best designing for business.
kanemarry · 11 weeks and 5 days ago
great content! will recommend this site to my friends best breast augmentation tulsa
looneyhans · 6 weeks and 1 day ago
I concur with the last tips whereby we have to manhandle what is eminent and inclining. By doing in that limit you can continue making something which is new and in the present style
sumanrajput · 2 weeks and 2 days ago
This post is cleared up in a to an awesome degree able way. The detail with which it is clarified is so skilled. I am perplexed by the manner by which you have cleared up things here.
sumanrajput · 2 weeks and 2 days ago
Hello, Extremely mind blowing this essential settlement are to an extraordinary degree bewildering and exceptionally pleasing for my control much thanks and sorry for my underwriting to set up everything here. http://www.jaipurescortservice.insss/
sumanrajput · 2 weeks and 2 days ago
Good data, basic and amazing graph, as offer all around completed with splendid insights and musings, piles of incredible data and motivation, the two of which I require, due to offer such a consistent data here
sumanrajput · 2 weeks and 2 days ago
looneyhans · 1 week and 4 days ago
nice very great post!
Killersmile · 1 week and 1 day ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: