Spiff59 Posted April 6, 2012 Share Posted April 6, 2012 (edited) I thought I'd post a recursive _FileListToArray() version that's approaching it's third birthday.It's one of the latter versions buried in Tlem's 263-post thread from June 2009:I don't claim authorship. Tlem started the ball rolling, contributing all along the way, many other members and about every MVP, MOD and even a couple DEV's had input in that thread. The function also draws from prior recursive _FileListToArray() versions.I do think it is still the most straight-forward version floating around, having all the most useful bells and whistles, and functions both efficiently and properly. It hasn't the "depth" or "sort" options available in the newer popular version by Melba23, but it offers a very concise single-function alternative.After nearly 3 years, I thought that something ought to be dug out of the obscurity of that massive thread (into which a lot of effort was invested by many) and placed where it's easier to find.This is identical to post 252 from the 2009 thread except the the function name is changed, the parameters are reordered to make it backward compatible with the production _FileListToArray, and the SRER escaping special characters, that used to have the comment " ; what other characters? ", is now complete.expandcollapse popup#include <Array.au3> #include <File.au3> $timer = TimerInit() $aArray = _FileListToArrayPlus(@WindowsDir, "s*.???.*", 1, "", "*.exe.*", 1, True) $timer = Round(TimerDiff($timer) / 1000, 2) & ' sec' _ArrayDisplay($aArray, $timer) Exit ; #FUNCTION# ===================================================================================================================== ; _FileListToArrayPlus($sPath, $sInclude = "*", $iFlag = 0, $sExcludeFolder = "", $sExclude = "", $iPathType = 0, $bRecursive = False) ; Name...........: _FileListToArrayPlus ; Parameters ....: $sPath: Folder to search ; $sInclude: String to match on (wildcards allowed, multiples delimited by ;) ; $iFlag: Returned data type. 0 = Files and folders (default), 1 = Files only, 2 = Folders only ; $sExcludeFolder: List of folders to exclude from search (wildcards allowed, multiples delimited by ;) ; $sExclude: List of filenames to exclude from search (wildcards allowed, multiples delimited by ;) ; $iPathType: Returned data format. 0 = Filename only (default), 1 = Path relative to $sPath, 2 = Full path/filename ; $bRecursive: False = Search $sPath folder only (default), True = Search $sPath and all subfolders ; Author ........: Half the AutoIt community (Forum thread #96952) ;=================================================================================================================================== Func _FileListToArrayPlus($sPath, $sInclude = "", $iFlag = 0, $sExcludeFolder = "", $sExclude = "", $iPathType = 0, $bRecursive = False) Local $sRet = "", $sReturnFormat = "" $sPath = StringRegExpReplace($sPath, "[/]+z", "") & "" ; ensure single trailing slash If Not FileExists($sPath) Then Return SetError(1, 1, "") ; Edit include files list If $sInclude = "*" Then $sInclude = "" If $sInclude Then If StringRegExp($sInclude, "[/:><|]|(?s)As*z") Then Return SetError(2, 2, "") ; invalid characters test $sInclude = StringRegExpReplace(StringRegExpReplace($sInclude, "(s*;s*)+", ";"), "A;|;z", "") ; Strip unwanted whitespace $sInclude = StringRegExpReplace($sInclude, "[][$.+^{}()]", "$0"); Ignore special characters $sInclude = StringReplace(StringReplace(StringReplace($sInclude, "?", "."), "*", ".*?"), ";", "$|") ; Convert ? to ., * to .*?, and ; to | $sInclude = "(?i)A(" & $sInclude & "$)"; case-insensitive, match from first char, terminate strings EndIf ; Edit exclude folders list If $sExcludeFolder Then $sExcludeFolder = StringRegExpReplace(StringRegExpReplace($sExcludeFolder, "(s*;s*)+", ";"), "A;|;z", "") ; Strip unwanted whitespace $sExcludeFolder = StringRegExpReplace($sExcludeFolder, "[][$.+^{}()]", "$0"); Ignore special characters $sExcludeFolder = StringReplace(StringReplace(StringReplace($sExcludeFolder, "?", "."), "*", ".*?"), ";", "$|") ; Convert ?=. *=.*? ;=| $sExcludeFolder = "(?i)A(?!" & $sExcludeFolder & "$)"; case-insensitive, match from first char, terminate strings EndIf ; Edit exclude files list If $sExclude Then $sExclude = StringRegExpReplace(StringRegExpReplace($sExclude, "(s*;s*)+", ";"), "A;|;z", "") ; Strip unwanted whitespace $sExclude = StringRegExpReplace($sExclude, "[][$.+^{}()]", "$0"); Ignore special characters $sExclude = StringReplace(StringReplace(StringReplace($sExclude, "?", "."), "*", ".*?"), ";", "$|") ; Convert ?=. *=.*? ;=| $sExclude = "(?i)A(?!" & $sExclude & "$)"; case-insensitive, match from first char, terminate strings EndIf ; MsgBox(1,"Masks","File include: " & $sInclude & @CRLF & "File exclude: " & $sExclude & @CRLF & "Dir exclude : " & $sExcludeFolder) If Not ($iFlag = 0 Or $iFlag = 1 Or $iFlag = 2) Then Return SetError(3, 3, "") Local $sOrigPathLen = StringLen($sPath), $aQueue[64] = [1,$sPath], $iQMax = 63 ; tuned? While $aQueue[0] $WorkFolder = $aQueue[$aQueue[0]] $aQueue[0] -= 1 $search = FileFindFirstFile($WorkFolder & "*") If @error Then ContinueLoop Switch $iPathType Case 1 ; relative path $sReturnFormat = StringTrimLeft($WorkFolder, $sOrigPathLen) Case 2 ; full path $sReturnFormat = $WorkFolder EndSwitch While 1 $file = FileFindNextFile($search) If @error Then ExitLoop If @extended Then ; Folder If $sExcludeFolder And Not StringRegExp($file, $sExcludeFolder) Then ContinueLoop If $bRecursive Then If $aQueue[0] = $iQMax Then $iQMax += 128 ; tuned? ReDim $aQueue[$iQMax + 1] EndIf $aQueue[0] += 1 $aQueue[$aQueue[0]] = $WorkFolder & $file & "" EndIf If $iFlag = 1 Then ContinueLoop $sRet &= $sReturnFormat & $file & "|" Else ; File If $iFlag = 2 Then ContinueLoop If $sInclude And Not StringRegExp($file, $sInclude) Then ContinueLoop If $sExclude And Not StringRegExp($file, $sExclude) Then ContinueLoop $sRet &= $sReturnFormat & $file & "|" EndIf WEnd FileClose($search) WEnd If Not $sRet Then Return SetError(4, 4, "") Return StringSplit(StringTrimRight($sRet, 1), "|") EndFuncEdit: Put the mysteriously disappearing "" back in. Thanks, agerrika & AZJIOEdit2: Correct all the missing backslashes. Edited October 4, 2012 by Spiff59 knightz93 1 Link to comment Share on other sites More sharing options...
Belini Posted April 6, 2012 Share Posted April 6, 2012 (edited) How to show all folders and subfolders listed in alphabetical order? $aArray = _FileListToArrayPlus(@WindowsDir, "s*.???.*", 2, "", "", 1, True) Edited April 6, 2012 by Belini My Codes: Â Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 Â 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Â Â Link to comment Share on other sites More sharing options...
knightz93 Posted April 11, 2012 Share Posted April 11, 2012 nice function, thanks, you solve my problem.. [font=verdana,geneva,sans-serif]I will do my best in this forum [/font][font=verdana,geneva,sans-serif]my code :[/font] WindowsSwitcher3d() Link to comment Share on other sites More sharing options...
Tlem Posted April 11, 2012 Share Posted April 11, 2012 Just some words :Can be that you should take back the same name of variable from the original function for the file(s) name ($sFilter).And, personnaly, I think that some parameters are more important than other. I would indeed see the function as this :_FileListToArrayPlus($sPath, $sFilter = "*", $iFlag = 0[, $bRecursive = False[, $iPathType = 0[, $sExcludeFile = ""[, $sExcludeFolder = ""]]]])Notes and explanations :$sExcludeFolder and $sExcludeFile are really optionnal by default. Their use are totally conditioned by a specific use. So they must be on the end of the function.$iPathType : Should not have so many flag. Path relative and Full path should widely be enough. What the interest of only filename for a recursive search ??? What about if you have the same filename on hundred folders.If you search on the root path, you should always have only the filename ... ^^$bRecursive : The interest of this function is the recursive search, so this parameter should be after the last "official" parameter of the original function : $iFlag.To be complete, you should add too in the description of the function, the error code and returns.I prefer personally the simplicity of DXRW4E function, because it corresponds more to the basic philosophy of AutoIt (except his last modification about the last flag). but now, the file and folder exclusion is a not insignificant bit extra (for some people).Regrettably, it is necessary to put limits, because otherwise, we meet fast with a heap of similar functions (you just have to make a search on this forum). All are quite interesting because there are specific, but by too complex for a simple use.If Dev have to add a recurcive search function, It should be the simplest possible :_FileListToArray($sPath[, $sFilter = "*"[, $iFlag = 0[, $iRecurse = 0]]])The result should be Path relative, because if you want full path, you just have to add $sPath.Now, for specific use, if you want only the filename or made file or folder exeption, a simple treatment should do the work. But, this is only my point of view. Best Regards.Thierry Link to comment Share on other sites More sharing options...
AZJIO Posted April 12, 2012 Share Posted April 12, 2012 TlemThe result should be Path relative, because if you want full path, you just have to add $sPath.uneconomical shorten the path, then again to combine. Speed will be slower. In most cases, the full path is required.If Dev have to add a recurcive search functionIt would be a good idea to have at least one search function including subdirectories. Very often asked. My other projects or all Link to comment Share on other sites More sharing options...
Tlem Posted April 13, 2012 Share Posted April 13, 2012 (edited) Hello, all. Because this function is presented to be a recursive files/folders FileListToArray, I really think that the recuse flag should be just after the file type. In accordance with my precedent post and for be in the same philosophy than included AutoIt functions, I have changed some vars name and finally, I have added a description like others AutoIt functions. I hope that you like it! expandcollapse popup; #FUNCTION# ==================================================================================================================== ; Name...........: _FileListToArrayPlus ; Description ...: Lists files andor folders in a specified path (Similar to using Dir with the /B Switch) ; Syntax.........: _FileListToArrayPlus($sPath[, $sFilter = "*"[, $iFlag = 0 [, $bRecursive = False[, $sExcludeFile = ""[, $sExcludeFolder = "" [, $iPathType = 1]]]]]]) ; Parameters ....: $sPath - Path to generate filelist for. ; $sFilter - Optional the filter to use, default is *. (Multiple filter groups such as "*.png;*.jpg;*.bmp") Search the Autoit3 helpfile for the word "WildCards" For details. ; $iFlag - Optional: specifies whether to return files folders or both ; |$iFlag=0 (Default) Return both files and folders ; |$iFlag=1 Return files only ; |$iFlag=2 Return Folders only ; $sExcludeFile - Optional: filter for file(s) exclusion. Multiple filters must be separated by ";" ; $sExcludeFolder - Optional: filter for folder(s) exclusion. Multiple filters must be separated by ";" ; $bRecursive - Optional: Use this flag to specify if you want to search in sub-directories too. ; |$bRecursive=False (default) Do not search in sub-directories ; |$bRecursive=True Search in sub-directories ; $iPathType - Optional: specifies displayed path of results ; |$iPathType = 0 - File/folder name only ; |$iPathType = 1 - Relative to initial path (Default) ; |$iPathType = 2 - Full path included ; Return values .: @Error ; |1 = Path not found or invalid ; |2 = Invalid $sFilter ; |3 = Invalid $iFlag ; |4 = No File(s)/Folder(s) Found ; Author ........: Half the AutoIt community (Forum thread #96952) ; Modified.......: ; Remarks .......: The array returned is one-dimensional and is made up as follows: ; $array[0] = Number of FilesFolders returned ; $array[1] = 1st FileFolder ; $array[2] = 2nd FileFolder ; $array[3] = 3rd FileFolder ; $array[n] = nth FileFolder ; Related .......: ; Link ..........: http://www.autoitscript.com/forum/topic/139336-recursive-filelisttoarray/ ; Example .......: Yes ; Note ..........: Special Thanks to the AutoIt community ; =============================================================================================================================== Func _FileListToArrayPlus($sPath, $sFilter = "", $iFlag = 0, $bRecursive = False, $sExcludeFolder = "", $sExcludeFile = "", $iPathType = 1) Local $sRet = "", $sReturnFormat = "" $sPath = StringRegExpReplace($sPath, "[/]+z", "") & "" ; ensure single trailing slash If Not FileExists($sPath) Then Return SetError(1, 1, "") ; Edit include files list If $sFilter = "*" Then $sFilter = "" If $sFilter Then If StringRegExp($sFilter, "[/:><|]|(?s)As*z") Then Return SetError(2, 2, "") ; invalid characters test $sFilter = StringRegExpReplace(StringRegExpReplace($sFilter, "(s*;s*)+", ";"), "A;|;z", "") ; Strip unwanted whitespace $sFilter = StringRegExpReplace($sFilter, "[][$.+^{}()]", "$0"); Ignore special characters $sFilter = StringReplace(StringReplace(StringReplace($sFilter, "?", "."), "*", ".*?"), ";", "$|") ; Convert ? to ., * to .*?, and ; to | $sFilter = "(?i)A(" & $sFilter & "$)"; case-insensitive, match from first char, terminate strings EndIf ; Edit exclude folders list If $sExcludeFolder Then $sExcludeFolder = StringRegExpReplace(StringRegExpReplace($sExcludeFolder, "(s*;s*)+", ";"), "A;|;z", "") ; Strip unwanted whitespace $sExcludeFolder = StringRegExpReplace($sExcludeFolder, "[][$.+^{}()]", "$0"); Ignore special characters $sExcludeFolder = StringReplace(StringReplace(StringReplace($sExcludeFolder, "?", "."), "*", ".*?"), ";", "$|") ; Convert ?=. *=.*? ;=| $sExcludeFolder = "(?i)A(?!" & $sExcludeFolder & "$)"; case-insensitive, match from first char, terminate strings EndIf ; Edit exclude files list If $sExcludeFile Then $sExcludeFile = StringRegExpReplace(StringRegExpReplace($sExcludeFile, "(s*;s*)+", ";"), "A;|;z", "") ; Strip unwanted whitespace $sExcludeFile = StringRegExpReplace($sExcludeFile, "[][$.+^{}()]", "$0"); Ignore special characters $sExcludeFile = StringReplace(StringReplace(StringReplace($sExcludeFile, "?", "."), "*", ".*?"), ";", "$|") ; Convert ?=. *=.*? ;=| $sExcludeFile = "(?i)A(?!" & $sExcludeFile & "$)"; case-insensitive, match from first char, terminate strings EndIf If Not ($iFlag = 0 Or $iFlag = 1 Or $iFlag = 2) Then Return SetError(3, 3, "") Local $sOrigPathLen = StringLen($sPath), $aQueue[64] = [1, $sPath], $iQMax = 63 ; tuned? While $aQueue[0] $WorkFolder = $aQueue[$aQueue[0]] $aQueue[0] -= 1 $search = FileFindFirstFile($WorkFolder & "*") If @error Then ContinueLoop Switch $iPathType Case 1 ; relative path $sReturnFormat = StringTrimLeft($WorkFolder, $sOrigPathLen) Case 2 ; full path $sReturnFormat = $WorkFolder EndSwitch While 1 $file = FileFindNextFile($search) If @error Then ExitLoop If @extended Then ; Folder If $sExcludeFolder And Not StringRegExp($file, $sExcludeFolder) Then ContinueLoop If $bRecursive Then If $aQueue[0] = $iQMax Then $iQMax += 128 ; tuned? ReDim $aQueue[$iQMax + 1] EndIf $aQueue[0] += 1 $aQueue[$aQueue[0]] = $WorkFolder & $file & "" EndIf If $iFlag = 1 Then ContinueLoop $sRet &= $sReturnFormat & $file & "|" Else ; File If $iFlag = 2 Then ContinueLoop If $sFilter And Not StringRegExp($file, $sFilter) Then ContinueLoop If $sExcludeFile And Not StringRegExp($file, $sExcludeFile) Then ContinueLoop $sRet &= $sReturnFormat & $file & "|" EndIf WEnd FileClose($search) WEnd If Not $sRet Then Return SetError(4, 4, "") Return StringSplit(StringTrimRight($sRet, 1), "|") EndFunc ;==>_FileListToArrayPlus It has not a lot of importance, but the way which are listed files/ folders is rather disturbing ! Edited April 13, 2012 by Tlem Best Regards.Thierry Link to comment Share on other sites More sharing options...
agerrika Posted September 30, 2012 Share Posted September 30, 2012 (edited) Hello,Agree with the last changes made by TlemI found a mistake using it. Missing in the following line$aQueue[$aQueue[0]] = $WorkFolder & $file & "" $aQueue[$aQueue[0]] = $WorkFolder & $file & "" Edited September 30, 2012 by agerrika Link to comment Share on other sites More sharing options...
AZJIO Posted October 1, 2012 Share Posted October 1, 2012 This is a problem forum. Symbol disappears, not only in this. When the example was uploaded it was without errors. My other projects or all Link to comment Share on other sites More sharing options...
guinness Posted October 1, 2012 Share Posted October 1, 2012 Just out of curiosity is this a feature request to update _FileListToArray? UDF List:  _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 1, 2012 Moderators Share Posted October 1, 2012 guinness, I think AZJIO is referring to the nasty habit the forum software has of removing "" characters from uploaded code from time to time. M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
guinness Posted October 1, 2012 Share Posted October 1, 2012 Ah, I meant Spiff59's post. UDF List:  _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Spiff59 Posted October 1, 2012 Author Share Posted October 1, 2012 Just out of curiosity is this a feature request to update _FileListToArray?That was the initial intention of the 2009 thread with 260+ posts. We had one Dev fully in favor of the idea, but later in the thread another Dev indicated he had no interest in replacing a 27-line function with one of 64 lines (even though the additional functionality was one constantly requested). The thread did end up creating a bugtrack entry, one that reduced the production _FileListToArray() down to it's current 18 lines. Link to comment Share on other sites More sharing options...
guinness Posted October 1, 2012 Share Posted October 1, 2012 I saw your addition/report and have to say what a clever approach, especially >> If ($iFlag + @extended = 2) Then ContinueLoop, most would have used a If..Else. Just nice! UDF List:  _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Spiff59 Posted October 1, 2012 Author Share Posted October 1, 2012 Just nice!Thank you, Sir It was convenient that the required logic allowed for such trickery.I, personally, still think a _FileListToArray() that processed subfolders would be a worthwhile addition to the production UDF. Whether this version, or this version with some changes, or a completely different version doesn't really matter (although I don't think anyone has beaten this version in a speed test to date). The inclusion of a production _FileListToArray() with folder recursion would, in perpetuity, reduce the number of threads in the general help forum by at least a couple a month. Link to comment Share on other sites More sharing options...
AZJIO Posted October 3, 2012 Share Posted October 3, 2012 Why is it not working?Returns the folder "System32"$aArray = _FileListToArrayPlus(@SystemDir) My other projects or all Link to comment Share on other sites More sharing options...
Spiff59 Posted October 3, 2012 Author Share Posted October 3, 2012 Why is it not working? Returns the folder "System32" $aArray = _FileListToArrayPlus(@SystemDir)When I patched the code because the forum oddly removes backslash characters, I only corrected one line and neglected to fix this one: $sPath = StringRegExpReplace($sPath, "[/]+z", "") & "" ; ensure single trailing slash which should be $sPath = StringRegExpReplace($sPath, "[/]+z", "") & "" ; ensure single trailing slash fixed now Link to comment Share on other sites More sharing options...
guinness Posted October 3, 2012 Share Posted October 3, 2012 My only gripe is that it doesn't support the Default keyword. UDF List:  _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
AZJIO Posted October 3, 2012 Share Posted October 3, 2012 $aArray = _FileListToArrayPlus(@WindowsDir, "s*.???.*", 1, "", "*.exe.*", 1, True)Returns 400 files. Do not match the mask. For example TASKMAN.EXE. The name must contain two dots. My other projects or all Link to comment Share on other sites More sharing options...
Spiff59 Posted October 4, 2012 Author Share Posted October 4, 2012 (edited) $aArray = _FileListToArrayPlus(@WindowsDir, "s*.???.*", 1, "", "*.exe.*", 1, True)Returns 400 files. Do not match the mask. For example TASKMAN.EXE. The name must contain two dots. Geez, I had thought the forum glitch had only converted "" into "". It did more than that! All the backslashes are missing from the regular expressions. I'll fix it when I get to work in the morning. Thanks. Edit: I replaced all the SRER statements. Edited October 4, 2012 by Spiff59 Link to comment Share on other sites More sharing options...
AZJIO Posted October 4, 2012 Share Posted October 4, 2012 check the line 38, 45$0 My other projects or all 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