Jump to content

Array Help...List folders in a certain directory


Recommended Posts

Can someone help me, please!

I need help creating an array that list the folders in a specific directory (according to certain criteria), and then uses the array output to delete those folders.

Here is what I came up with, but of course, it doesn't work...doesn't delete the folders. :)

#Include <File.au3>
#Include <Array.au3>
$FileList=_FileListToArray("C:\Software\", "Proxy*")
If @Error=1 Then
 MsgBox (0,"","No Files\Folders Found.")
 Exit
EndIf

$Output = _ArrayDisplay($FileList,"$FileList")

DirRemove($Output, 1)
Link to comment
Share on other sites

Can someone help me, please!

I need help creating an array that list the folders in a specific directory (according to certain criteria), and then uses the array output to delete those folders.

Here is what I came up with, but of course, it doesn't work...doesn't delete the folders. :)

#Include <File.au3>
#Include <Array.au3>
$FileList=_FileListToArray("C:\Software\", "Proxy*")
If @Error=1 Then
 MsgBox (0,"","No Files\Folders Found.")
 Exit
EndIf

$Output = _ArrayDisplay($FileList,"$FileList")

DirRemove($Output, 1)
$FileList is the array of Folders

$Output is only the return value of 1 or 0

Try looping thru the array and do a DirRemove on each element.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Rough example ..

#Include <File.au3>
#Include <Array.au3>
$FileList=_FileListToArray("C:\Software\", "Proxy*", 2)
If @Error=1 Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf

$Output = _ArrayDisplay($FileList,"$FileList")

For $i = 1 To $FileList[0]
    DirRemove("C:\Software\" & $FileList[$i], 1)
Next

Cheers

Edited by smashly
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...