What is a util i can use to recursively delete empty folders? empty is considered to be true if the directory has no directory no files exist excepting useless/generated files (thumbs, .DS_Store, etc)

link|improve this question

55% accept rate
can't you write your question without redefining the word empty? empty already has a meaning in windows in the context of deleting directories. It means EMPTY. NOTHING IN IT. Same as in english. – barlop Dec 27 '10 at 7:58
feedback

5 Answers

Try this one.

http://download.cnet.com/Remove-Empty-Directories/3000-2248_4-10755867.html

link|improve this answer
Here is a tutorial about using Remove Empty Directories doztech.net/how-tos/… – Doztech Aug 7 '10 at 18:57
Nice website Ryan. – Moab Aug 8 '10 at 14:45
feedback

Your question is unclear

Here is me removing an empty directory
C:\>md f
C:\>rmdir f
C:\>

there, I created one, then removed it.

If there are things in it then it is not empty.

You can use rmdir /s if there are things in it.

C:\>rmdir f
The directory is not empty.

C:>rmdir /s f
f, Are you sure (Y/N)? y

C:\>

And you can do all that without the command prompt.

Recursion is a concept in programming. I don't think you mean that. And whether something is implemented using recursion or not, is irrelevant to you since no doubt you don't intend to limit yourself.. and you weren't just intellectually curious about implementations.

You should rewrite your entire question.

And if you are having trouble deleting a directory, then think for example, about what error you get when you try to delete the directory you are struggling to delete. You could always boot off a live CD and delete it.

OK.. I see velio and moab figured out what you want to do.

Really you could have asked your question without redefining the word empty. It already has a meaning which is obvious and shared with english and even rmdir uses the term.

link|improve this answer
Looks like Moab and probably velio figured out what you want to do. Scan through your hard drive searching for empty directories, or directories with little junk windows files, so you can delete them. I guess that's one way of saving space ;-) – barlop Dec 27 '10 at 7:55
Actually on some operating systems term "recursively" is used for directory deletion. For example famous rm -rf. – AndrejaKo Dec 27 '10 at 8:19
@AndrejaKo I know about rm -rf and recursive.. and I wrote with that in mind too, and I am pretty sure that in the rm case the implementation is recursive. – barlop Jan 3 '11 at 19:36
feedback

Here is a command line one-liner that will delete every actually empty (i.e. zero files) directory in the folder and below:

for /f "delims=" %i in ('dir /ad /s /b') do @rd "%i"

Basically this gets a recursive listing of all directories starting from the current and then attempts to remove each directory. The rd command will not remove a non-empty directory by default so your files should be safe.

link|improve this answer
feedback

Belvedere can do that, but you'll need to be more specific than "useless" to be able to set up the right rules.

link|improve this answer
feedback

Use Command Prompt from Start\ Run (or the combination Windows key and R). Write cmd to start the console then navigate to the drive the directories are on by inputting the drive letter (e.g. if they are on D:\ you put d:). The path of the Command will change to the desired path then use the command cd to travel to the empty directories parent folder (cd D:\ParentDirectory). You can use the Tab for Windows to put the entire path. Once arrived at the parent directory use del /F EmptyDirectory1

This method is the best one and also will delete folders or files that can't be deleted by Windows Explorer.

link|improve this answer
1  
with an answer as yawn worthy as that, i'm a bit reluctant to correct you.. If he had trouble opening a command prompt, he could ask a question on that. But this is really for "super users", so you can assume they can open a command prompt, and if they can't they can ask. Otherwise there's no end to it. MOVE THE MOUSE UP, MOVE THE MOUSE DOWN. Onto your answer, DEL won't delete directories. – barlop Dec 27 '10 at 8:04
feedback

Your Answer

 
or
required, but never shown

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