Adventure Game Studio

Community => General Discussion => Topic started by: Ren on Wed 25/06/2008 20:03:40

Title: A programm that deletes all empty folders.
Post by: Ren on Wed 25/06/2008 20:03:40
Is there such software?
If not, can anyone show me how to code it in C++?
Title: Re: A programm that deletes all empty folders.
Post by: SSH on Wed 25/06/2008 20:21:02

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

Title: Re: A programm that deletes all empty folders.
Post by: Ren on Wed 25/06/2008 20:21:56
I'll try that
Title: Re: A programm that deletes all empty folders.
Post by: Ren on Wed 25/06/2008 20:25:34
Can i have the full code, please?

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

If this helps i'm using Visual C++ Express (etc)
Title: Re: A programm that deletes all empty folders.
Post by: AGA on Wed 25/06/2008 20:32:26
That's a DOS command, not C++. Press Win+R, type 'cmd', then type all that into the window that opens.
Title: Re: A programm that deletes all empty folders.
Post by: Ren on Wed 25/06/2008 20:48:59
It doesn't work for me.
Title: Re: A programm that deletes all empty folders.
Post by: EldKatt on Wed 25/06/2008 21:56:56
Doesn't run or just doesn't work? If the latter... do empty directories really have zero size? Thinking out loud here.
Title: Re: A programm that deletes all empty folders.
Post by: SSH on Wed 25/06/2008 21:59:16
Well, it works fine in Linux and HP-UX. Install cygwin and it should work on Windows, too ;)
Title: Re: A programm that deletes all empty folders.
Post by: Matti on Wed 25/06/2008 21:59:54
"xargs" isn't recognized...
Title: Re: A programm that deletes all empty folders.
Post by: 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?
Title: Re: A programm that deletes all empty folders.
Post by: EldKatt on Wed 25/06/2008 22:08:41
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.
Title: Re: A programm that deletes all empty folders.
Post by: Matti on Wed 25/06/2008 22:17:59
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"..
Title: Re: A programm that deletes all empty folders.
Post by: scotch on Wed 25/06/2008 22:31:00
Like SSH said, that's a linux/unix command, you can install cygwin (http://www.cygwin.com) and get those tools on Windows. Or if you'd prefer here's a python (http://www.python.org) program to do it:
import os
for dir, subdirs, files in os.walk("/"):
    if not files and not subdirs: os.rmdir(dir)
Title: Re: A programm that deletes all empty folders.
Post by: Ren on Thu 26/06/2008 16:27:35
Now it says something about loops.
Title: Re: A programm that deletes all empty folders.
Post by: MrColossal on Thu 26/06/2008 20:56:38
If you get an error you should explain the error exactly and write it out word for word.
Title: Re: A programm that deletes all empty folders.
Post by: Ren on Thu 26/06/2008 22:16:29
Now it says:
''failed to remove '(path)': no such file or directory
Title: Re: A programm that deletes all empty folders.
Post by: BOYD1981 on Thu 26/06/2008 22:42:04
if you had bothered searching you would have found both this (http://www.pcmag.com/article2/0,1759,805015,00.asp) and this (http://simonwai.com/developments/empty_folder_nuker/) amongst other things.
Title: Re: A programm that deletes all empty folders.
Post by: Ren on Thu 26/06/2008 23:03:45
Thanks. Just what i've been  looking for