Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

opeddir function

Status
Not open for further replies.

leo2180

IS-IT--Management
Jun 7, 2000
52
US
I'm using the openddir function in one of my scripts and I'm running into a problem.&nbsp;&nbsp;Here's the code:<br><br>opendir (DIR,&quot;Some remote directory&quot;);<br><br>..............<br><br>closedir (DIR);<br><br>now the directory that Im trying to open is and has to be a remote directory (some directory on a computer out there on the network).&nbsp;&nbsp;I cant seem to find out how to do that.&nbsp;&nbsp;I've tried putting \\servername\directoryname and that doesnt work, what do I need to do to get this accomplished?
 
This works on my winnt box to a mounted drive....<br><FONT FACE=monospace><br>#!perl<br>opendir(DIR,&quot;J:Temp&quot;) ¦¦ die &quot;Failed to open DIR, $!\n&quot;;<br>@files = readdir(DIR);<br>close DIR;<br>foreach $file (@files){ print &quot;$file\n&quot;; }<br></font><br><br>....and this works on my UNIX(solaris) box to a networked file system...<br><FONT FACE=monospace>#!/usr/local/bin/perl<br>opendir(DIR,&quot;/server/homes/julmer&quot;) ¦¦ die &quot;Failed $!\n&quot;;<br>@files = readdir(DIR);<br>close DIR;<br>print @files;<br></font><br><br>hope this helps. <p> <br><a href=mailto: > </a><br><a href= > </a><br> keep the rudder amid ship and beware the odd typo
 
the first one will work if Im running the file from my machine only tough.&nbsp;&nbsp;If someone else on the network is trying to run the script it wont work.&nbsp;&nbsp;Thats the problem I'm having, having everyone be able to run this script and it works with no problem or them having to edit the script at all...
 
Do you mean that goBoating's WinNT example works for you?&nbsp;&nbsp;Are the other people's J: drives mapped like yours?&nbsp;&nbsp;Also check user permissions or domain authentication issues. - Scott <p>Scott McCrory<br><a href=mailto:scott@mccrory.com>scott@mccrory.com</a><br><a href= > </a><br>
 
yeah the first one wil work if and only if the script is running on my machine and my machine only.&nbsp;&nbsp;If someone else try to run the script it wouldnt work, because of the mapped drive withing the script.&nbsp;&nbsp;I need a way to open a directory on another machine remotely.
 
Your out of my area of familiarity.......If your other Win OS machines do not have their drives mapped to the same letters, then I don't know.&nbsp;&nbsp;I guess you could write the script to poll the local machine's available drives and use some logic to figure out which one you want to go after.&nbsp;&nbsp;I would also do a little surfing through CPAN and ActiveState.com to see if anyone has addresses this in a module yet.<br><br>Good Luck. <p> <br><a href=mailto: > </a><br><a href= > </a><br> keep the rudder amid ship and beware the odd typo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top