devrandom Posted March 6, 2011 Share Posted March 6, 2011 Hello! I use this code to get the list of files in a directory: FileChangeDir(@DesktopDir) $first = FileFindFirstFile("*") $next = FileFindNextFile($first) $allfiles = "" While $next <> "" $allfiles &= $next & " " $next = FileFindNextFile($first) WEnd MsgBox(0, "Files:", $allfiles) But how can I get the list of folders? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 6, 2011 Moderators Share Posted March 6, 2011 devrandom,Just use the _FileListToArray function - it finds files and/or folders and you do not have to write all that code. If you want a recursive version that looks in subfolders as well then look at RecFileListToArray in my sig. 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...
devrandom Posted March 6, 2011 Author Share Posted March 6, 2011 (edited) thank you EDIT: I noticed that my function finds folders too :S I'm sorry... Edited March 6, 2011 by devrandom Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 6, 2011 Moderators Share Posted March 6, 2011 devrandom,But did you notice how to distinguish between files and folders? From the Help file: "@extended set to 1 if filename is a directory" 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...
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