DoctorX Posted November 17, 2005 Share Posted November 17, 2005 Is there a way to use wildcards with DirRemove? What I want to do is remove a folder which does not always have the same name, but it begins with the same two letters. Essentially I am looking for the equivalent of this: FileDelete (@TempDir & "\f4*.*") Except I need to do the same for all folders that begin with "f4". Any ideas? -DRX Link to comment Share on other sites More sharing options...
Valuater Posted November 17, 2005 Share Posted November 17, 2005 this will do the trick #Include <File.au3> #Include <Array.au3> Dim $location = @TempDir $FileList=_FileListToArray($location, "f4*", 2) If (Not IsArray($FileList)) Or (@Error=1) Then MsgBox (0,"","No Files\Folders Found.") Exit EndIf _ArrayDisplay($FileList,"$FileList") ; clear these comments "#cs & #ce" when you are sure... very sure ; this will DELETE ALL FILES INSIDE f4* FOLDERS #cs If $FileList[0] >=1 Then For $x = 1 to $FileList[0] DirRemove($location & "\" & $FileList[$x], 1) Next EndIf #ce 8) Link to comment Share on other sites More sharing options...
DoctorX Posted November 17, 2005 Author Share Posted November 17, 2005 That did it. Thank you very much! -DRX Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now