Sign in to follow this  
Followers 0
pedrosojones

How can I delete folders from a result _FileListToArray

2 posts in this topic

#1 ·  Posted (edited)

Hi,

How can I delete folders from a result _FileListToArray

There is my initial script

#include <Array.au3>
#include <File.au3>
$FolderList = _FileListToArray("C:\Documents and Settings")
_ArrayDisplay($FolderList, "Before the delete")
For $i = UBound($FolderList) - 1 To 0 Step -1
    If $FolderList[$i] = "Administrator" Then
        _ArrayDelete($FolderList, $i)
    ElseIf $FolderList[$i] = "All users" Then
        _ArrayDelete($FolderList, $i)
        ElseIf $FolderList[$i] = "Default User" Then
        _ArrayDelete($FolderList, $i)
        ElseIf $FolderList[$i] = "LocalService" Then
        _ArrayDelete($FolderList, $i)
        ElseIf $FolderList[$i] = "NetworkService" Then
        _ArrayDelete($FolderList, $i)
        ElseIf $FolderList[$i] = @UserName Then
        _ArrayDelete($FolderList, $i)
    EndIf
Next
_ArrayDisplay($FolderList, "Afterdelete")

And I want to delete all the folders that you can see in the file attached "AfterDelete"

Thanks a lot

post-56305-0-14679500-1308296183_thumb.j

Edited by pedrosojones

Share this post


Link to post
Share on other sites



For $i = 1 To Ubound($FolderList) -1
    DirRemove("C:\Documents and Settings\" & $FolderList[$i], 1)
Next


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

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  
Followers 0