Jump to content

Recommended Posts

I need to reach Win server, scan shared folder and find out what is last created file name on this folder, and than copy this file to local folder. BUT main problem is smb, never used it before, and this is what i came up  with, but no luck.

require_once('smbclient.php');
$latest = null;

    $smbc = new smbclient ('//10.1.1.10/Share/Address Verification/', 'domain\\username', 'password');
     if ($handle = opendir($smbc)) {
    $latest = null;
    while (($cur = readdir($handle) !== false)) {
        if ($latest == null || filectime($cur) > filectime($latest)) {
            $latest = $cur;
        }
    }
    closedir($handle);
}
return $latest;

please help, returns Warning: opendir() expects parameter 1 to be string

i never worked with samba, and i going mad, coz this is second day for this simple task...and i cannot solve it

I am not familiar with this php class at all, but have experience with samba servers (by the way, actually this is not a samba server). Have you tried to establish a connection using smbclient from your Unix machine?

I am not familiar with this php class at all, but have experience with samba servers (by the way, actually this is not a samba server). Have you tried to establish a connection using smbclient from your Unix machine?

smbclient connection works perfectly, i use it to get  files with known names, but at this case i can't know the name, i need to find name of most recent file that exist in the directory.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.