Jump to content
Sign in to follow this  
FastFrank

Locating a file

Recommended Posts

FastFrank

Hi guys,

Newbie here, I just found out about Autoit and I'm really excited to see how much easier this will make my life. I'd like to know how I can locate a file on the computer where the script is running. Basically there is a file named xyz.dat on the computer and I need to copy the file abc.dat right in the same folder. So basically I want to find out the path to xyz.dat. I didn't see any Filefind function or anything.

Can anyone help?

Thanks

Frank

Share this post


Link to post
Share on other sites
flaxcrack

Hi guys,

Newbie here, I just found out about Autoit and I'm really excited to see how much easier this will make my life. I'd like to know how I can locate a file on the computer where the script is running. Basically there is a file named xyz.dat on the computer and I need to copy the file abc.dat right in the same folder. So basically I want to find out the path to xyz.dat. I didn't see any Filefind function or anything.

Can anyone help?

Thanks

Frank

Frank,

Crack open the help file and look up FileFindFirstFile and FileMove

Good luck!


[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Share this post


Link to post
Share on other sites
FastFrank

Yeah I saw those functions, i wasn,t sure what they were doing exactly. The help file is kinda slim on these two. I guess I'll try to use them and see what comes up.

But if anyone as a user-made function that's more newbie friendly I'd like to see it.

thanks

Share this post


Link to post
Share on other sites
ChrisL

This would probably do it or you could modify it to do it, you'll need the beta version of AutoIT

Search ("C:")

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  $file = "xyz.dat" then MsgBox (0,"Path to file is ", $current & "\")
            
        EndIf
        If StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then
            Search($current & "\" & $file)
            
        EndIf
    WEnd
    FileClose($search)

EndFunc
Edited by ChrisL

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  

×