Sign in to follow this  
Followers 0

Can autoit search a drive & delete empty folders?

13 posts in this topic

#1 ·  Posted

Can autoit search a drive & delete empty folders?

Share this post


Link to post
Share on other sites



#2 ·  Posted

No ?

Share this post


Link to post
Share on other sites

#3 ·  Posted

Removes (deletes) a directory.

RMDIR [/Q] [drive:]path

RD [/Q] [drive:]path

    /S      Removes all directories and files in the specified directory

            in addition to the directory itself.  Used to remove a directory

            tree.

    /Q      Quiet mode, do not ask if ok to remove a directory tree with /S

So...

$folder = '"C:\my folder"'
Run(@ComSpec & " /c rmdir /S /Q " & $folder, "", @SW_HIDE)

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

#4 ·  Posted

That would just delete C:\my folder right ?

I need to search the whole c drive and remove any empty folders it finds.

Share this post


Link to post
Share on other sites

#5 ·  Posted

Bah, sorry. I'm not reading properly today :ph34r:

You could probably code AutoIt to do that, but I found a nifty one by using a google search that might be very helpful.


[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

#6 ·  Posted

Yes I found them too . all want the money . lol

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I found this one that seems to work .

http://www.snapfiles.com/get/rmempty.html

Can you show me how I can add the drive letter in with a input box .

Run(@ComSpec & " /k RMEMPTY.EXE C:\")

Right now I have it hard coded in .

Edited by bobheart

Share this post


Link to post
Share on other sites

#8 ·  Posted

why not...

$drive = FileSelectFolder("Select drive or folder to remove empty folders from","",0)
Run(@ComSpec & " /k RMEMPTY.EXE " & $drive)

untested, but here you go.


"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

#9 ·  Posted

Thank you that was perfect ..

Share this post


Link to post
Share on other sites

#10 ·  Posted

I don't suppose FileGetSize could have worked here too?

ie

if Filegetsize($myfolder) = 0 then filedelete($myfolder)

or whatever.. (didn't test this.. but just a thought)

Share this post


Link to post
Share on other sites

#11 ·  Posted

I don't suppose FileGetSize could have worked here too?

ie

if Filegetsize($myfolder) = 0 then filedelete($myfolder)

or whatever.. (didn't test this.. but just a thought)

If you could show a little more code so I could try it . then i could get rid of the other exe .

Share this post


Link to post
Share on other sites

#12 ·  Posted

yeah I just read the help file on it.. says "does not work on directories" for the FileGetSize function in autoit.. :(

but maybe a round about way? ie looking in the folder for *.* and if no results returned the delete..??

More complicated I think.. :ph34r:

Share this post


Link to post
Share on other sites

#13 ·  Posted

Ok i'll stick with what i found unless something comes along better .

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0