billgatetlhai Posted May 27, 2009 Share Posted May 27, 2009 I want to list all directory in drive C. Who can help me solve my task? Link to comment Share on other sites More sharing options...
oMBRa Posted May 27, 2009 Share Posted May 27, 2009 _FileListToArray Link to comment Share on other sites More sharing options...
torels Posted May 27, 2009 Share Posted May 27, 2009 or FileFindFirstFile() ... go and look it up in the helpfile Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
smashly Posted May 27, 2009 Share Posted May 27, 2009 (edited) Hi, expandcollapse popup$hGui = GUICreate("Please Wait... Getting All Directories on drive: " & @HomeDrive, 660, 410, -1, -1) $List = GUICtrlCreateList("", 5, 5, 650, 400) GUISetState(@SW_SHOW, $hGui) $LD = _ListDirectories(@HomeDrive, 1) $aCnt = StringSplit($LD, "|") GUICtrlSetData($List,$LD) WinSetTitle($hGui, "", "Finished... " & $aCnt[0] & " Directories Found on drive: " & @HomeDrive) $aCnt = 0 Do Until GUIGetMsg() = -3 Func _ListDirectories($sPath, $iRecurse = 0, $iDepth = 0) Local $hSearch, $sFile, $sFileList If Not $iDepth Then Global $sHoldFiles = '' If Not FileExists($sPath) Then Return SetError(1, 1, "") If Not ($iRecurse = 0 Or $iRecurse = 1) Then Return SetError(2, 0, "") EndIf If StringRight($sPath, 1) <> "\" Then $sPath &= "\" $hSsearch = FileFindFirstFile($sPath & "*") If $hSearch = -1 Then Return SetError(3, 0, "") While 1 $sFile = FileFindNextFile($hSsearch) If @error Then ExitLoop If StringInStr(FileGetAttrib($sPath & $sFile), "D") Then If $iRecurse Then _ListDirectories($sPath & $sFile, $iRecurse, $iDepth + 1) $sHoldFiles &= $sPath & $sFile & "|" EndIf WEnd FileClose($hSsearch) If Not $iDepth Then $sFileList = StringTrimRight($sHoldFiles, 1) $sHoldFiles = "" Return $sFileList EndIf EndFunc Edited May 27, 2009 by smashly Link to comment Share on other sites More sharing options...
Tec Posted May 27, 2009 Share Posted May 27, 2009 dir c: /s /b /ad Link to comment Share on other sites More sharing options...
smashly Posted May 27, 2009 Share Posted May 27, 2009 dir c: /s /b /ad > dir.txt 2x Link to comment Share on other sites More sharing options...
Tec Posted May 27, 2009 Share Posted May 27, 2009 That was not the request Link to comment Share on other sites More sharing options...
rudi Posted May 28, 2009 Share Posted May 28, 2009 (edited) Hi. I want to list all directory in drive C. Who can help me solve my task? Use FileListToArray3.au3 to do so: #include <filelisttoarray3.au3> ; to be found at http://www.autoitscript.com/forum/index.php?act=attach&type=post&id=18938"]FileListToArray3.au3 #include <array.au3> ; required for _arraydisplay() $DirArr=_FileListToArray3("C:\","*",2,1) ; BasePath,Pattern,DirsOnly,Recurse _ArrayDisplay($DirArr) ... depending on the number of files on C: this will take a while! With that array it's easy to to further operations whatsoever you need to do. Regards, Rudi. edit: added comment to $DirArr= line. Edited May 28, 2009 by rudi Earth is flat, pigs can fly, and Nuclear Power is SAFE! 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