Sign in to follow this  
Followers 0
infernothebest

search extention

5 posts in this topic

i wanna make a autoit file thats search on extention and write it in a text file, but i must see the full path and date

i got this so far

$search = FileFindFirstFile("*.prt")
If $search = -1 Then
        FileWriteLine("1.txt", $search)
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf
While 1
$file = FileFindNextFile($search) 
If @error Then ExitLoop
    FileWriteLine("1.txt", $file)
WEnd
FileClose($search)

Share this post


Link to post
Share on other sites



i think this would help but it doesnt work 100% i need some changes and your help

$tosearch = "C:"
$output = FileOpen("c:\filelist.txt",1)
$start = TimerInit()
RecFileSearch($tosearch)
FileClose($output)
MsgBox(0,"done","it only took " & int(TimerDiff($start)/1000) & " seconds")
Func RecFileSearch($current)
    Local $search = FileFindFirstFile($current & "\*.prt")
    While 1
    Dim $file = FileFindNextFile($search)
    If @error Or StringLen($file)<1 Then ExitLoop
    FileWriteLine($output,$current & "\" & $file & "     " & FileGetSize($file))
    If StringInStr(FileGetAttrib($current & "\" & $file),"D") And ( $file <> "." Or $file <> ".." ) Then RecFileSearch($current & "\" & $file)
    WEnd
    FileClose($search)
EndFunc

it must give me the date from the file and it must look in all folders and subfolders and look for the extention .prt, then it must write a file with all the data

Share this post


Link to post
Share on other sites

Maybe this may suit your needs. The Dir command may seach C: faster then FFFF\FFNF.

RunWait(@ComSpec & ' /c Dir C:\*.prt /s/b > "' & @ScriptDir & '\temp.txt"', '', @SW_HIDE)
$handle_read = FileOpen(@ScriptDir & '\temp.txt', 0)
$handle_write = FileOpen(@ScriptDir & '\prt.txt', 2)
While 1
    $line = FileReadLine($handle_read)
    If @error Then ExitLoop
    $file = StringStripWS($line, 3)
    If Not $file Then ContinueLoop
    If FileExists($file) Then
        FileWriteLine($handle_write, FileGetTime($file, 0, 1) & @TAB & FileGetSize($file) & @TAB & $file)
    EndIf
WEnd
FileClose($handle_read)
FileClose($handle_write)
FileDelete(@ScriptDir & '\temp.txt')

It may give you are different view to create your list. :P

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0