Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I want to find all folders within a given folder that contain no files (but folders are ok). This needs to be recursive - it looks in all child folders.

I can find folders that are completely empty using the Number if Items search criteria set to less than 1. However, this does not return folders that have other folders inside them.

I am basically trying to delete folders that had files in that I have deleted the contents from using a previous search.

share|improve this question
add comment

1 Answer 1

Here is a terminal command

find . -type d -empty

And if you want to delete these files :

find . -type d -empty -delete
share|improve this answer
    
That finds empty directories in the current working directory, but not empty directories inside it. How do I make this recursive? –  dunxd Jan 20 '13 at 1:40
    
It turns out that the folders have some hidden files in, so they aren't returned at all with this command :-( –  dunxd Jan 20 '13 at 1:42
2  
@dunxd If they are .DS_Store files, you can delete them with find ~/Folder -name .DS_Store -delete. –  Lri Jan 20 '13 at 14:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.