Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am on a unix server and want to open up an NT Infoserver directory to read the files in it. Please advise how or what the path should look like to get it open?? I have tried many variations (with forward and backward slashes and slashes in front of my path etc...) and can not open it.
#!/usr/local/bin/perl $dir = "/Infoserver/firstdirectory/seconddirectory/mydirectory"; opendir(DIR, $dir) || die "Can not open: $!\n"; while(defined ($file = readdir DIR)) { print "$file\n" } closedir(DIR);

Replies are listed 'Best First'.
Re: Reading a Directory on another server
by waswas-fng (Curate) on Jan 03, 2003 at 19:22 UTC
    Not really a perl question but: What Unix are you running? Many don't support CIFS (SMB) out of the box -- and almost all of the ones that do dont support transperant UNC addresses. so you will have to mount, or use automount or some such to access the share (if your unix supports it in the kernel) else use some type of smbclient to access via a commandline.

    -Waswas
      Okay, I am using Solaris 7 and not sure what CIFS(SMB) is? Please advise steps I can do to get this to work in my shell?

      Thanks
        Welp this is really not a perl question, but take a look at docs for smbsh you run that as the shell and it allows you to use nt shares. all info can be found on www.samba.com or by asking questions on a samba mailing list. edited: also a comercial tool called Sharity exists and may work for you needs as well.

        -Waswas
Re: Reading a Directory on another server
by Callum (Chaplain) on Jan 03, 2003 at 19:20 UTC
    First of check how the filesystem in question is being exported from the NT server, then verify that you can access it from your Unix shell.

    Your code, as presented, should work, so long as the $dir in question can be accessed from your shell.