Jump to content

FileFindFirstFile in shared files


Recommended Posts


I have got a problem with searching files in shared files. Usually I use recursive funcions with FileFindFirstFile and FileFindNextFile. But in \\ for example FileFindFirstFile returns an error. Do you have an idea to solve this problem?

Thank you

arnonym :mellow:

Link to comment
Share on other sites


!! UNC convention!!. You never find something on \\

\\<name or ip>\<sharename or administrative share like c$\<folder>

e.g -> $search = FileFindFirstFile ("\\\c$\temp\*.tmp")

Initialize search on ipaddress in administrative share c$ in folder temp any tmp file.



Link to comment
Share on other sites

Thx for your answer 99ojo,

but I don't understand the problem.

On the "server" I shared the folder "C:\temp".

But if I try your suggestion it doesn't work.


Can you help me one more time?

Thanks for the fast reply! :mellow:


Edited by arnonym
Link to comment
Share on other sites


my suggestion works only on Windows Server. For accessing administrative share, you must have administrative rights on server.

For your example:

1) Share c:\temp as Temp

2) Per default on windows server Everyone has Read Access on share, you might have a problem with your ntfs settings.

3) So your code should look like this: FileFindFirstFile("\\\temp\*.tmp")

If this doesn't work, check your share access: Start Button -> Run -> \\\temp and then press enter.

If no explorer window popups or an error occured, you have problems accessing share.

This is then a configuration problem of your share and not an autoit problem.



Link to comment
Share on other sites

this is kind of cheesey but it works everytime :mellow:

Func CheeseyFind()
    $Server = '\\\c$\Temp\'
    $Local = @TempDir
    Dim $File = $Local & '\find.txt'
    Dim $Where

    $Dir = $Server & '*.tmp'

    RunWait(@ComSpec & ' /c ' & 'dir "' & $Dir & '" /a :h /b /s' & ' > "' & $Local & '\find.txt"', '', @SW_HIDE)

    _FileReadToArray($File, $Where)

    For $x = 1 To $Where[0]
        MyFunc($Where[$x]) ; Or do what you want to do with results , in this example its called line at a time.


EndFunc   ;==>CheeseyFind
Edited by lordicast
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

  • Recently Browsing   0 members

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