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

I posted this question earlier and found it would be easier to do it on a NT instead of Unix but still can not open an NT Infoserver from my NT workstation. I have tried slashes backward and forward:
$dir = "\\Infoserver\firstdirectory\seconddirectory\mydirectory"; $dir = "//Infoserver/firstdirectory/seconddirectory/mydirectory"; $dir = "////Infoserver/firstdirectory/seconddirectory/mydirectory";
Still no luck. any advise??
#perl on nt $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: Open NT inforserver from NT workstation
by osama (Scribe) on Jan 06, 2003 at 15:33 UTC

    You really should have tried a few more times before posting

    Why not map the share as a network drive, can be done by using net use from a command line or from inside a Perl script (backticks or system)

      It would be better to use one of the Win32 modules to do this. That way it'll be easier to handle errors.

      Take a look for example at Win32::FileOp's Map().

      Jenda

      How would I use "net use" with what I have?

        Unless you are going to hit that directory heavily and or constantly; I wouldn't. It would mean a little more coding for mapping and verifying errors(especically if you use a scheduler).

        You can use backticks but personally, I like to stay with Perl and the Modules.

        You could look at the NetResource module for dealing with shares.

        You really should have tried a few more times before posting

      Why? Isn't this place about helping? What would be the correct times to attempt a solution? 10, 1000?

      At least he kept working at it after the post and later returned to say he corrected it.

      Don't forget as a noob, the obvious is not always that apparent.

      If you are just not seeing the mistake, is it wrong to post "What am I missing?"

Re: Open NT inforserver from NT workstation
by Marza (Vicar) on Jan 06, 2003 at 18:21 UTC

    Take a look at File::Find It makes your life a little easier.

    use File::Find; find (\&wanted , "//Infoserver/firstdirectory/seconddirectory/mydirect +ory" ); sub wanted { print "$File::Find::name\n"; }
Re: Open NT inforserver from NT workstation
by Anonymous Monk on Jan 06, 2003 at 13:30 UTC
    I got it to work with:
    $dir = "//Infoserver/firstdirectory/seconddirectory/mydirectory";
    Sorry I should have checked it better before posting this question.