ahha Posted June 25, 2006 Posted June 25, 2006 I'm sure someone has done this and hate to reinvent. I need something like what this batch file produces. dir c:*.* /s/b > c:\dir_list.txt which is just a complete listing of path+filename for all files on a drive put into a text file. Thanks
GaryFrost Posted June 25, 2006 Posted June 25, 2006 I'm sure someone has done this and hate to reinvent. I need something like what this batch file produces. dir c:*.* /s/b > c:\dir_list.txt which is just a complete listing of path+filename for all files on a drive put into a text file. Thanks RunWait(@ComSpec & ' /c dir c:*.* /s/b > c:\dir_list.txt",'',@SW_HIDE) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Xenobiologist Posted June 25, 2006 Posted June 25, 2006 I'm sure someone has done this and hate to reinvent.I need something like what this batch file produces.dir c:*.* /s/b > c:\dir_list.txtwhich is just a complete listing of path+filename for all files on a drive put into a text file.ThanksHI,you could run that command with _RunDos()... So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
Skruge Posted June 25, 2006 Posted June 25, 2006 Welcome to the forums!dir c:*.* /s/b > c:\dir_list.txtwhich is just a complete listing of path+filename for all files on a driveKeep in mind that c:*.* is a relative path. You'll only get a listing for the current directory onward.To get the full drive, use c:\*.* [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]
ahha Posted June 25, 2006 Author Posted June 25, 2006 Welcome to the forums!Keep in mind that c:*.* is a relative path. You'll only get a listing for the current directory onward.To get the full drive, use c:\*.*Thanks all. Skruge thanks for the reminder on the backslash. I thought there might be a program coded in Autoit that walked the directory rather than having to dive into DOS.
ChrisL Posted June 26, 2006 Posted June 26, 2006 (edited) Thanks all. Skruge thanks for the reminder on the backslash. I thought there might be a program coded in Autoit that walked the directory rather than having to dive into DOS. This should do what you want although it does not list files alphabetically as such files are listed in order by windows "Table Of Contents" FileFindNextFile $logfile = FileOpen ("C:\DirectoryList.txt",2) Search ("c:");replace with your search directory Func Search($current) Local $search = FileFindFirstFile($current & "\*.*") While 1 Dim $file = FileFindNextFile($search) If @error Or StringLen($file) < 1 Then ExitLoop If Not StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then If $current & "\" & $file <> "C:\DirectoryList.txt" then FileWriteLine ($logfile,$current & "\" & $file) EndIf If StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then Search($current & "\" & $file) EndIf WEnd FileClose($search) EndFunc Func OnAutoitExit() FileClose ($logfile) EndFunc Edited June 26, 2006 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
randallc Posted June 26, 2006 Posted June 26, 2006 Thanks all. Skruge thanks for the reminder on the backslash. I thought there might be a program coded in Autoit that walked the directory rather than having to dive into DOS.Hi,Speed is the issue; See various solutions under "recursive" link below in my sig; but running DOS is heaps quicker!Best, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW
ahha Posted June 30, 2006 Author Posted June 30, 2006 Chris - thanks. For some reason I keep getting this when I run it. "Unable to open file, the maximum number of open files has been exceeded.: Local $search = FileFindFirstFile($current & "\*.*")" I'll recheck the code and try and figure it out. This should do what you want although it does not list files alphabetically as such files are listed in order by windows "Table Of Contents" FileFindNextFile $logfile = FileOpen ("C:\DirectoryList.txt",2) Search ("c:");replace with your search directory Func Search($current) Local $search = FileFindFirstFile($current & "\*.*") While 1 Dim $file = FileFindNextFile($search) If @error Or StringLen($file) < 1 Then ExitLoop If Not StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then If $current & "\" & $file <> "C:\DirectoryList.txt" then FileWriteLine ($logfile,$current & "\" & $file) EndIf If StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then Search($current & "\" & $file) EndIf WEnd FileClose($search) EndFunc Func OnAutoitExit() FileClose ($logfile) EndFunc
MHz Posted June 30, 2006 Posted June 30, 2006 Chris - thanks. For some reason I keep getting this when I run it. "Unable to open file, the maximum number of open files has been exceeded.: Local $search = FileFindFirstFile($current & "\*.*")"I'll recheck the code and try and figure it out.The problem with Chris's code is that it is calling the function Search() within itself before closing handles and opening new handles. This will make the error of too many open files.Calling a function within itself is not healthy code. Recursion errors can happen also from this method. Either use the Dir command built within ComSpec (as randallc has pointed to) or have a look for Larry's FileSearch UDF in Scripts'n'Scraps.
ahha Posted June 30, 2006 Author Posted June 30, 2006 MHz - I saw that and tried to figure out how to insert a FileClose so that it did not remain open with too many files. I'll search for Larry's code. Thanks.The problem with Chris's code is that it is calling the function Search() within itself before closing handles and opening new handles. This will make the error of too many open files.Calling a function within itself is not healthy code. Recursion errors can happen also from this method. Either use the Dir command built within ComSpec (as randallc has pointed to) or have a look for Larry's FileSearch UDF in Scripts'n'Scraps.
ChrisL Posted June 30, 2006 Posted June 30, 2006 (edited) Chris - thanks. For some reason I keep getting this when I run it. "Unable to open file, the maximum number of open files has been exceeded.: Local $search = FileFindFirstFile($current & "\*.*")"I'll recheck the code and try and figure it out.I'll bet you are not using the beta version. I tried this on my entire c: drive and it is fine.If you have a 64 level deep recursion of folders I'd be supprisedAlso if you close the filehandles before they are ready it cant find the next file, try my code with the latest beta http://www.autoitscript.com/autoit3/files/beta/autoit/ Edited June 30, 2006 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
ahha Posted June 30, 2006 Author Posted June 30, 2006 ChrisL - okay as a newbie I have a target on my back. Go ahead and shoot me. I have several versions of AutoIt installed. I'm using SciTE, so how do I make sure it's pointing to a particular AutoIt version? Thanks. ahhaI'll bet you are not using the beta version. I tried this on my entire c: drive and it is fine.If you have a 64 level deep recursion of folders I'd be supprisedAlso if you close the filehandles before they are ready it cant find the next file, try my code with the latest beta http://www.autoitscript.com/autoit3/files/beta/autoit/
Skruge Posted June 30, 2006 Posted June 30, 2006 (edited) MsgBox(0,"Version", @AutoItVersion) Edited June 30, 2006 by Skruge [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]
ChrisL Posted June 30, 2006 Posted June 30, 2006 ChrisL - okay as a newbie I have a target on my back. Go ahead and shoot me. I have several versions of AutoIt installed. I'm using SciTE, so how do I make sure it's pointing to a particular AutoIt version? Thanks. ahhaIn scite go Tools/BetarunWhen the script finishes I beleive it tells you the autoit version in the output from sciteIf you put the messgae box in that skruge suggested this will also tell you [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
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