Jump to content

holy crap is there some way to read all files in a directory


Recommended Posts

Naw not gunna work.

It dont know the name of file/s.

I need to find out the files in the folder.

BASICLY dir command in cmd but i tryed cmd dir @scrptdir but that dont work.

It dosnt know how to translate ti from cmd to the script.

Edited by kcd-clan
Visit mEMy programs made.Iul - IulG-V Console - G-V Console_RandomLetter - _RandomLetter()Saftey Kill - Saftey Killcolorzone() = colorzone()
Link to comment
Share on other sites

Naw not gunna work.

It dont know the name of file/s.

I need to find out the files in the folder.

FileFindFirstFile takes wildcards. Look at the example in the helpfile.

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

This will open all the exe files in a directory.. i think

Run("C:directory_name*.exe")
Run doesn't take wildcards, and the OP isn't trying to execute every file.

it needs to read all file names and then read more code in each file.

Can not be executed and the program needs to do it.

once it reads the code its going to have it stored in the program.

Did you figure out FileFindFirstFile? Look at FileRead / FileReadLine / _FileReadToArray to "read the code" in each file.

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

This is not tested... i don't think it works but you can try

#Include <GUIConstants.au3>
GUICreate("File Reader", 500, 600)
$data = GUICtrlCreateEdit("Data", 40, 300, 400, 400)
$data2 = FileRead("C:\directory_name\*.*")
GUIctrlsetdata($data, $data2)

The co-ords will probably be messed up, i made them off the top of my head

Edited by codemyster
Link to comment
Share on other sites

This is not tested... i don't think it works but you can try

#Include <GUIConstants.au3>
GUICreate("File Reader", 500, 600)
$data = GUICtrlCreateEdit("Data", 40, 300, 400, 400)
$data2 = FileRead("C:directory_name*.*")
GUIctrlsetdata($data, $data2)
No, FileRead doesn't take wildcards either.

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

I don't see how hard it is to look in the helpfile under FileFindFirstFile (as been suggested several times).

Very slightly modified version of the helpfile script gives me this:

$First = FileFindFirstFile (@ScriptDir & "\*.*")

If $First = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf
$filestr = ""
While 1
    $file = FileFindNextFile($First) 
    If @error Then ExitLoop
    
    $filestr &= $file & @CRLF
WEnd
MsgBox(4096, "Files:", $filestr)

FileClose($First)
Link to comment
Share on other sites

IT DOSE NOT WORK........

If some one is a programmer and knows how to make a dll to return files in dirm using cmd dir

somthing like so

function readDIR($DIR){

run cmd

$dir= dir()

return $dir

}

if i could use php i know how to do it with that.

Im not any good with vbs so i cant do taht :/

Edited by kcd-clan
Visit mEMy programs made.Iul - IulG-V Console - G-V Console_RandomLetter - _RandomLetter()Saftey Kill - Saftey Killcolorzone() = colorzone()
Link to comment
Share on other sites

IT DOSE NOT WORK........

Respectfully, may I suggest that if code that is given to you doesn't work that you tell us what error you received so that people can help you more effectively.

The code posted required the beta version. If you have the release version, this code should work:

Func readDIR($DIR)
    Local $filestr, $First, $file
    $First = FileFindFirstFile ($DIR & "\*.*")
    While 1
        $file = FileFindNextFile($First)
        If @error Then ExitLoop
        $filestr = $filestr & @CRLF & $file
    WEnd
    FileClose($First)
    Return $filestr
EndFunc
BlueBearrOddly enough, this is what I do for fun.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...