A programm that deletes all empty folders.

Started by Ren, Wed 25/06/2008 20:03:40

Previous topic - Next topic

Ren

Is there such software?
If not, can anyone show me how to code it in C++?
and then there will be cake...

SSH

Code: ags

find / -size 0 -type d -print | xargs rmdir

12

Ren

and then there will be cake...

Ren

Can i have the full code, please?

I just learned ''Hello World!''...

If this helps i'm using Visual C++ Express (etc)
and then there will be cake...

AGA

That's a DOS command, not C++. Press Win+R, type 'cmd', then type all that into the window that opens.

Ren

#5
It doesn't work for me.
and then there will be cake...

EldKatt

Doesn't run or just doesn't work? If the latter... do empty directories really have zero size? Thinking out loud here.

SSH

Well, it works fine in Linux and HP-UX. Install cygwin and it should work on Windows, too ;)
12

Matti


SSH

12

EldKatt

I'm not sure it would work even on Linux, SSH. :P The size of a directory (which is just a file that is a directory) has nothing to do with its contents, right? Mine are all 4096b, whatever they contain.

Matti

Quote from: SSH on Wed 25/06/2008 22:04:36
Quote from: matti on Wed 25/06/2008 21:59:54
"xargs" isn't recognized...

by what?

The windows console (cmd.exe).

Something like:" 'xargs' is spelled wrong or couldn't be found"..

scotch

Like SSH said, that's a linux/unix command, you can install cygwin and get those tools on Windows. Or if you'd prefer here's a python program to do it:
Code: ags
import os
for dir, subdirs, files in os.walk("/"):
    if not files and not subdirs: os.rmdir(dir)

Ren

and then there will be cake...

MrColossal

If you get an error you should explain the error exactly and write it out word for word.
"This must be a good time to live in, since Eric bothers to stay here at all"-CJ also: ACHTUNG FRANZ!

Ren

Now it says:
''failed to remove '(path)': no such file or directory
and then there will be cake...

BOYD1981

if you had bothered searching you would have found both this and this amongst other things.

Limey Lizard, Waste Wizard!
01101101011000010110010001100101001000000111100101101111011101010010000001101100011011110110111101101011

Ren

Thanks. Just what i've been  looking for
and then there will be cake...

SMF spam blocked by CleanTalk