Jump to content

Delete all files/folders in a folder.

Recommended Posts

He already has code to do what he wants (see my very simple code above), but I think he's left the forum. Your code looks like it might be more than he needs, as you have added a lot of very good flexibility for other situations...
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to post
Share on other sites

.....(see my very simple code above)....

I have taken a look at it.... and discover a function : StdoutRead() .. seems very interesting, for example retrieving output from WSH script execution thru cscript.exe...

I will take a closer look tomorrow. (it's time to go bed here... ;) )

Link to post
Share on other sites

Not sure if this would help you - I did this [ with the help from Larry ] a while back. It will delete all the files / folders from a dir but will ignore anything thats in the 'keep me' dir.

$search = FileFindFirstFile("*.*")
; Check if the search was successful
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")

While 1
    $file = FileFindNextFile($search)
    If @error <> 0 Then ExitLoop
    If $file = "keep me" Then ContinueLoop
    If $file = "." Or $file = ".." Then ContinueLoop
    If StringInStr(FileGetAttrib(@SCRIPTDIR & "\" & $file) , "D") Then
        DirRemove($file, 1)
        FileDelete(@SCRIPTDIR & "\" & $file)
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...