Jump to content
Sign in to follow this  

DirRemove w/ Wildcard

Recommended Posts


I found this thread w/ a non working example: '?do=embed' frameborder='0' data-embedContent>>

I made a few changes and now it appears it is working.


$path = "C:\Users\frpatrmo\desktop\home\"
$search = FileFindFirstFile("C:\Users\frpatrmo\desktop\home\test*")
While 1
    $file = FileFindNextFile($search)
    If @Error then ExitLoop
    ;debug current file name
    ;MsgBox(0, "", $file)
    $ats = FileGetAttrib($path & $file)
    ;debug current file attribute
    ;MsgBox(0, "", $ats)
    If StringInStr($ats, "D") Then
        DirRemove($path & $file, 1)
Anybody know a better way to do a "wildcard" file/dir delete? I know the FileDelete() supports them by default, so this would be mostly for directory removal. I used it to clean up these oracle folders that had random names.

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.