MrCreatoR Posted March 7, 2011 Share Posted March 7, 2011 Melba23It is very strange that sorting option make the function return much more longer than the search process itself.I mean this:_RecFileListToArray(@ProgramFilesDir, "*", 0, 1, 0, 2)will return much faster then this:_RecFileListToArray(@ProgramFilesDir, "*", 0, 1, 1, 2)(sort option is 1) Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 7, 2011 Author Moderators Share Posted March 7, 2011 It is very strange that sorting option make the function return much more longerI quite agree that sorting the results adds a fair time to the whole process - but why is it strange that this is the case? If you do not sort the result you get the files in the order returned by FileFindNextFile which is not necessarily alphabetical order (although it usually is on NTFS systems). And because the process is iterative and not recursive, it actually explores the folders in reverse order. So as I wanted an aphabetical and folder-based list I wrote the algorithm to make sure that the results were sorted that way - which was pretty complex and took most of the development time. As I pointed out earler in the thread, you would not have been impressed with the early versions - they were painfully slow on anything but the shortest paths. The development of FileFindNextFile setting @extended to indicate folders helped enormously as it removed the need to get and search the attributes, but the main bottleneck is the need to manipulate the arrays holding the returned files and folders - especially if you wish to display both as you are in the examples you post. As Valik pointed out not too long ago, arrays are not exactly AutoIt's strongest suit. If you have any ideas for speeding the sort algorithm, while retaining the same output, I would be delighted to hear them. I used custom versions of the _Array_* functions with most of the errorchecking removed to increase their speed and tried to keep the ReDim calls to a minimum, but there are certainly things I missed or tricks I do not know. 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...
MrCreatoR Posted March 7, 2011 Share Posted March 7, 2011 If you have any ideas for speeding the sort algorithm, while retaining the same output, I would be delighted to hear them.First of all you should remove the ReDim in ArrayInsert (redim the array before the loop), it is a major speed limiter.You also could use temp array to sort (build it during the search). Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 8, 2011 Author Moderators Share Posted March 8, 2011 MrCreatoR, Good points - I will look into them. Thanks for the interest and input. 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...
Bowmore Posted March 8, 2011 Share Posted March 8, 2011 (edited) @Melba23As your array of files will is likely to be mostly already sorted a simple insertion sort, such as the one below, will usually be quicker than a quicksort. Func _InsertionSort(ByRef $aArray, $iMinRow = 0, $iMaxRow = 0 ) Local $iUB = UBound($aArray) - 1 Local $tmp = "" Local $j = 0 If $iMaxRow = 0 or $iMaxRow > $iUB Then $iMaxRow = $iUB EndIf If $iMinRow >= $iMaxRow Then Return SetError(1,0,0) EndIf for $i = $iMinRow to $iMaxRow $tmp = $aArray[$i]; $j = $i - 1; While ($j >= 0) And ($aArray[$j] > $tmp) $aArray[$j + 1] = $aArray[$j] $j -= 1; WEnd $aArray[$j + 1] = $tmp; Next EndFuncEdit: I should have done more testing before posting. All though an insertion sort is quicker when the data is mostly already sorted in this case if sub folders are searched the resulting array is a long way from being sorted and the insertion sort is much slower than quicksort. Edited March 8, 2011 by Bowmore "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 9, 2011 Author Moderators Share Posted March 9, 2011 Bowmore,if sub folders are searched the resulting array is a long way from being sortedToo true - and using the iterative method almost guarantees that the files are nowhere near sorted initially. That is why I found the sort algorithm the most complicated part of the UDF. It gets even worse if you have files in the root folder because a simple insertion sort can stuff them in among the folder files rather than keeping them all together in a section as logic would suggest. Thus the code to keep them in a separate array to be concatenated later. 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...
Moderators Melba23 Posted March 14, 2011 Author Moderators Share Posted March 14, 2011 New Version - 14 Mar 2011Changed - New sort algorithm for "return files and folders" search - very, very much faster. Added - New sort option: 0 = No sort; 1 = Sort files alphabetically; 2 = Leave files in order returned FileFindNextFile - this is usually alphabetical for NTFS drives. New UDF and zip in first post. 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...
startrek Posted March 21, 2011 Share Posted March 21, 2011 (edited) It doesn't search recursively in subfolders if you specify search criteria?? Or am i too tired to understand $aArray = _RecFileListToArray($sProgFiles & "\AutoIt3\", "*", 0, 1, 1) scans subfolders $aArray = _RecFileListToArray($sProgFiles & "\AutoIt3\", "*.txt", 0, 1, 1) Do not scan subfolders or $aArray = _RecFileListToArray($sProgFiles & "\AutoIt3", "*", 1, 0, 1, 0, "*.exe") Do not scan subfolders Edited March 21, 2011 by startrek Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 21, 2011 Author Moderators Share Posted March 21, 2011 (edited) startrek,Welcome to the AutoIt forum. The UDF will search recursively if you set the $iRecur parameter to anything other than 0. But the search parameters apply to both files and folders.So in your 3 examples:_RecFileListToArray($sProgFiles & "\AutoIt3\", "*", 0, 1, 1) will search in all subfolders and sort the resulting array of all folders and files - because the mask is "*" and everything matches. _RecFileListToArray($sProgFiles & "\AutoIt3\", "*.txt", 0, 1, 1) will search in folders which match the mask for files which match the mask and sort the resulting array of all folders and files - but it will not search in subfolders that do not match the "*.txt" mask, which is probably the majority. _RecFileListToArray($sProgFiles & "\AutoIt3", "*", 1, 0, 1, 0, "*.exe") will search in folders which match the mask for files which match the mask and are not excluded and sort the resulting array of files - here you should match all the folders and only exclude .exe files. This behaviour was inherited from the _FileListToArray UDF included with the standard install. I hope the explanation is sufficient - please ask again if not. And you are not the first to get caught out by it either - both in the original or this more capable UDF . By a strange coincidence I am currently working on a new version of the UDF which will allow you to search all folders for files which match the mask - thus removing the limitation you have come across. Check back in a few days - I am testing it hard at the moment.....in between decorating my bedroom, reoiling the garden furniture, playing golf, getting the lawnmower started......... M23Edit: Typnig! Edited March 21, 2011 by Melba23 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...
startrek Posted March 21, 2011 Share Posted March 21, 2011 Thanks:) i've actually been a member for a couple of years.. But i lost my account information in a harddrive crach along with all my scripts:( and can't seem to remember the email i used to register:S ooh obviously I didn't see that the variable for recursive was set to 0 in the (exclude .exe) example.. that was what got me confused:P I remember modifying an UDF so it could search any folder.. But since I been playing golf and getting my lawn mower started to much lately;) and not enough coding i don't remember how:P Looking forward to your updated UDF:) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 31, 2011 Author Moderators Share Posted March 31, 2011 New Version - 31 Mar 2011Changed - Filter behaviour when recursively searching for "files and folders" - addition of a further optional filter parameter.This change has been implemented to retain compatibility with the existing _FileListToArray function while removing a limitation of that compatibility when returning both "files and folders". Full explanation in first post.Short version:Searching non-recursively for "files and folders" with values in $sInclude_List (other than "*") or $sExclude_List (other than "") means that both files and folders that do not match the filters are ignored during the search.Searching recursively for "files and folders" only applies the filters to the files - all folders are searched and returned. Folders can be excluded by using an additional filter parameter.This change does not affect the behaviour of the UDF when returning only "files" or "folders" in either recursive or non-recursive searches.New UDF, example and zip in first post. 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 March 31, 2011 Share Posted March 31, 2011 (edited) Brilliant Update It's personally not a biggy for me, but I can see some users asking "Why the Example fails in the .ZIP?" It's currently pointing to "RecFileListToArray_Mod.au3"... so I though I would let you know. Edited March 31, 2011 by guinness 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 March 31, 2011 Author Moderators Share Posted March 31, 2011 guinness,TVM - fixed. Glad you like it - keep an eye out for the new version of ChooseFileFolder which is much faster with this new capability. 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...
Spiff59 Posted April 3, 2011 Share Posted April 3, 2011 New Version - 31 Mar 2011Changed - Filter behaviour when recursively searching for "files and folders" - addition of a further optional filter parameter.This change has been implemented to retain compatibility with the existing _FileListToArray function while removing a limitation of that compatibility when returning both "files and folders". Full explanation in first post.Short version:Searching non-recursively for "files and folders" with values in $sInclude_List (other than "*") or $sExclude_List (other than "") means that both files and folders that do not match the filters are ignored during the search.Searching recursively for "files and folders" only applies the filters to the files - all folders are searched and returned. Folders can be excluded by using an additional filter parameter.This change does not affect the behaviour of the UDF when returning only "files" or "folders" in either recursive or non-recursive searches.New UDF, example and zip in first post. M23We'd come to the same conclusion 2 years ago and implemented separate Exclude parms for folders and files: Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 4, 2011 Author Moderators Share Posted April 4, 2011 Spiff59, Ah well, I got there in the end! 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...
AdamUL Posted May 16, 2011 Share Posted May 16, 2011 @Melba23I wanted to let you know that there is a problem with the update for this UDF. The 3-14 version returns an array without a problem, but the 3-31 version returns @error = 1 and @extended = 9. Here is an example script showing the issue.$sPathSearch = "C:" $sFolderFilter = "of???arc" $aArray = _RecFileListToArray($sPathSearch, $sFolderFilter, 2, 1, 0, 2) If @error Then ConsoleWrite("Directory Search Error: @error=" & @error & " @extended=" & @extended & @CRLF) Exit 1 EndIfI know that "of???arc" is a valid search string as used in FileFindFirstFile, and worked in the previous version of your UDF for the include list. For this example, the $aArray returned should have been 2 elements: [1, "C:\gwarch\ofl7carc"]. I have reverted back to using the previous version, 3-14, since it does not give me errors. I thought you would like to know about this issue.Adam Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 22, 2011 Author Moderators Share Posted May 22, 2011 AdamUL,Thank you for pointing out that problem. When I changed the logic of the filters in the last update I missed the fact that it would have that effect on a recursive "folders only" search. I have now rejigged the filter logic to allow recursive searching for folders which should solve your problem - without, I hope, introducing any new ones! The new version is in the first post. 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...
nico18n Posted May 23, 2011 Share Posted May 23, 2011 @ Melba23 Very good. Just a useful function. I needed really. Good job. Link to comment Share on other sites More sharing options...
AdamUL Posted May 23, 2011 Share Posted May 23, 2011 Melba23, I'm glad I could help. Thanks for updating the UDF so quickly. I wasn't exactly sure what change caused the problem. Hopefully, I don't run into any more problems. If I do, I will be sure to let you know. Adam Link to comment Share on other sites More sharing options...
AZJIO Posted June 11, 2011 Share Posted June 11, 2011 (edited) necessary $sFilter = 'exe;msi;scr;dll;cpl;ax' or '*.exe;*.msi;*.scr;*.dll;*.cpl;*.ax' Edited June 11, 2011 by AZJIO My other projects or all Link to comment Share on other sites More sharing options...
Recommended Posts