Superbrka Posted February 22, 2019 Share Posted February 22, 2019 Hi, Is there any way to set up folder filter in _FileListToArrayRec() to get following array ? Folder structure: C:. ├───Folder_1 │ └───Job_1 │ └───SUBFOLDER_1 ├───Folder_2 │ └───Job_1 │ └───SUBFOLDER_1 └───Trash And what i want to have in array is only: C:\Temp\Folder_1\Job_1 C:\Temp\Folder_2\Job_2 Any help is going to be appreciated. Bye #include <File.au3> #include <Array.au3> Local $dir="C:\Temp" DirCreate("C:\Temp\TRASH") DirCreate("C:\Temp\Folder_1\Job_1\SUBFOLDER_1") DirCreate("C:\Temp\Folder_2\Job_1\SUBFOLDER_1") $FOLDER_ARRAY = _FileListToArrayRec($dir, "*", $FLTAR_FOLDERS, -1, $FLTAR_FASTSORT, $FLTAR_FULLPATH) _ArrayDisplay($FOLDER_ARRAY) Link to comment Share on other sites More sharing options...
Nine Posted February 22, 2019 Share Posted February 22, 2019 $FOLDER_ARRAY = _FileListToArrayRec($dir, "Job_*", $FLTAR_FOLDERS, -1, $FLTAR_FASTSORT, $FLTAR_FULLPATH) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
mikell Posted February 22, 2019 Share Posted February 22, 2019 #include <File.au3> #include <Array.au3> Local $dir="C:\Temp" DirCreate("C:\Temp\TRASH") DirCreate("C:\Temp\Folder_1\Job_1\SUBFOLDER_1") DirCreate("C:\Temp\Folder_2\Job_1\SUBFOLDER_1") $FOLDER_ARRAY = _FileListToArrayRec($dir, "*", $FLTAR_FOLDERS, -1, $FLTAR_FASTSORT, 1) ;_ArrayDisplay($FOLDER_ARRAY) Local $res[0] For $i = 1 to $FOLDER_ARRAY[0] (StringInStr($FOLDER_ARRAY[$i], "\") <> 0) ? _ArrayAdd($res, $dir & "\" & $FOLDER_ARRAY[$i]) : 0 Next _ArrayDisplay($res) Link to comment Share on other sites More sharing options...
Superbrka Posted February 25, 2019 Author Share Posted February 25, 2019 Hello, Thanks for the replay. But, what if a second subfolders are randomly named (Like, instead "Job_1" -> "123", "abc", "9a9" ) ? Is there a way to get a list ? Thanks in advance for your help Link to comment Share on other sites More sharing options...
mikell Posted February 25, 2019 Share Posted February 25, 2019 2 hours ago, Superbrka said: what if a second subfolders are randomly named Then you will need a 2nd step - something like my previous code or so Link to comment Share on other sites More sharing options...
Superbrka Posted February 25, 2019 Author Share Posted February 25, 2019 Thank you, that was my first solution as well but, the speed is "quite slow" i thought it would be faster with the some filter setup. Maybe someone knows other solution? There must be a (fast) way to get a list of subfolder structure up/from to a certain level, or not ? Thanks Link to comment Share on other sites More sharing options...
AdamUL Posted February 25, 2019 Share Posted February 25, 2019 Try not sorting in the _FileListToArrayRec call, but after. This may speed it up, depending on how large the path tree is. From the help file for _FileListToArrayRec. Quote Sorting the results will significantly increase the time required for the UDF to return the array. Adam 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