Jump to content
Sign in to follow this  
neo van matix

Get Filename ?

Recommended Posts

neo van matix

Hello,

i'd like to write a little Script, which updates my Virus-Definitions.

On a local Server a Program is running, which writes every day an definition-exe.

The problem is, that the version of the definition-exe is namend in the filename, like def24444.exe.

On every update, the filename varied.

I need the filename to run the program, i tested "run("def*.exe")", dont work.

So i tried to get the name via FileFindFirstFile(), but that returns 0 and no name :/

Some ideas?


Attention! English noob ^^

Share this post


Link to post
Share on other sites
Nomad

This was taken directly from the help menu, and it worked fine for me.

FileChangeDir("set_the_directory_you_need_here")

; Shows the filenames of all files in the current directory, note that "." and ".." are returned.
$search = FileFindFirstFile("def*.exe")  

; Check if the search was successful
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf

While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop
    
    MsgBox(4096, "File:", $file)
WEnd

; Close the search handle
FileClose($search)

You just need to select the directory it will be stored at, then it will display every file that matches the description. You will need to fine tune it to find the specific file you want though.

Nomad


Share this post


Link to post
Share on other sites
neo van matix

Works, and i dont know why...

Maybe, because i didnt change the File Dir :/

thanks :)


Attention! English noob ^^

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.