I'm looking for a script that will recursively search and delete any empty folders. Preferably bash or perl. I might be able to do it myself in bash, but Im not sure how to check for the empty folder?

I'm looking for a script that will recursively search and delete any empty folders. Preferably bash or perl. I might be able to do it myself in bash, but Im not sure how to check for the empty folder?
Not really my area, having only limited experience of Linux (though I do use it as my home operating system) but this post might help you with the bash script.
UNIX BASH scripting: How to check folder size in linux - Linux Newbie

bit of a bodge, rmdir should error if the dir isn't empty
Code:find . -type d -exec rmdir {} \;
RabbieBurns (9th February 2009)

that works, thanks![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)