Jump to content
Sign in to follow this  

Delete a known string from an array?

Recommended Posts

Been looking at _ArrayDelete as i have an array i cant seem to exclude one folder from

This is a non working example

$CleanUpFolders = _FileListToArrayRec(@ScriptDir, "*||Downloaded_Files", 2, 1) ; Make a variable of the second unpacked files for cleanup and exclude the unpacker
_ArrayDisplay($CleanUpFolders, "Retest Cleanup Folders")

For $i = 1 To $CleanUpFiles[0]
DirRemove( $CleanUpFiles[$i], 1)

prob is with _FileListToArrayRec it doesnt exclude the folder because of this condition

  Exclude_Folders = only used if $iRecur = 1 AND $iReturn <> 2 to exclude defined folders (default = "" [none])

there is a load of folders that i want to remove and one that i dont (Downloaded_Files)


These dont work

#include <Array.au3>

Local $aArray[5] = [0, 1, 'Test', 3, 4]

_ArrayDisplay($aArray, "Original")
_ArrayDelete($aArray, 'Test',)
_ArrayDisplay($aArray, "Element 2 deleted")
#include <Array.au3>

Local $aArray[5] = [0, 1, 'Test', 3, 4]

_ArrayDisplay($aArray, "Original")
Local $del = 'Test'
_ArrayDelete($aArray, $del)
_ArrayDisplay($aArray, "Element 2 deleted")

So how do i remove it from the array before processing and i dont know the postion number in the array as it will be different everytime


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  

  • Create New...