iahngy Posted January 29, 2014 Posted January 29, 2014 Is there a way to look up for a folder name but I just know half part of it by using autoit coding? for example, my full folder names are HG1234_1972, HG1234_1973, HG1234_1975 ..... it just has the same name before underscore but different number after underscore and I only know the name HG1234 ... is there a way to code so it can list all folders with that name HG1234?
Moderators Melba23 Posted January 29, 2014 Moderators Posted January 29, 2014 iahngy,Yes, look at _FileListToArray (or _FileListToArrayRec if the folders are not within the same folder) - both accept wildcards in the path parameter and both will list folders as well as files. 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
iahngy Posted January 29, 2014 Author Posted January 29, 2014 Argh Melba, it works for me today using _filelisttoarray.
Quual Posted January 30, 2014 Posted January 30, 2014 I was so bored....I decided to write a function for you... Local $sFolders = GetMatchingFolders('C:\FullPathTo\Folder\YouWant\ToSearch', 'HG1234_') If $sFolders Then Local $aFolders = StringRegExp($sFolders, '([^\|]+)', 3) For $f In $aFolders MsgBox(0, '', $f) Next EndIf Func GetMatchingFolders($sSearchRoot, $sStartsWith) Local $hFound = FileFindFirstFile($sSearchRoot & '\*'), $sNext, $sMatches If $hfound <> -1 Then While 1 $sNext = FileFindNextFile($hFound) If @error Then ExitLoop ElseIf @extended Then If StringInStr($sNext, $sStartsWith) = 1 Then $sMatches &= $sSearchRoot & '\' & $sNext & '|' EndIf WEnd EndIf FileClose($hFound) Return $sMatches EndFunc an even more bored person
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