Jump to content

Can autoit search a drive & delete empty folders?


Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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 .
Link to comment
Share on other sites

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:

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...