Opening a network connected drive from dos w/ perl 
Author Message
 Opening a network connected drive from dos w/ perl

I currently running Win 95' and using the PC version of Perl. I was
wondering if there is some way to have my perl script open up a network
drive? I just wrote a very simple find script, I run it from c: and want
it to connect to a network drive and exe. the script, and then post the
results on c:......Is this possible?????

[heres the script if it helps]
[begin script]
#!/usr/local/bin/perl


        if $running_under_some_shell;

require "find.pl";

open(LOG, ">c:\temp\find.log");   #putting the info on c:\temp
# Traverse desired filesystems

&find('e:.');     #e:. is the network drive trying to connect to.

exit;

sub wanted {
    /^'*\.X.*'$/ &&
    print("$name\n");

Quote:
}

[end script]

        Thanks for any help.
           JIM



Tue, 04 Apr 2000 03:00:00 GMT  
 Opening a network connected drive from dos w/ perl


thats why no one has answered my question???

        Thanks,
   Jim Patton

Quote:

> I currently running Win 95' and using the PC version of Perl. I was
> wondering if there is some way to have my perl script open up a network
> drive? I just wrote a very simple find script, I run it from c: and want
> it to connect to a network drive and exe. the script, and then post the
> results on c:......Is this possible?????

> [heres the script if it helps]
> [begin script]
> #!/usr/local/bin/perl


>         if $running_under_some_shell;

> require "find.pl";

> open(LOG, ">c:\temp\find.log");   #putting the info on c:\temp
> # Traverse desired filesystems

> &find('e:.');     #e:. is the network drive trying to connect to.

> exit;

> sub wanted {
>     /^'*\.X.*'$/ &&
>     print("$name\n");
> }
> [end script]

>         Thanks for any help.
>            JIM

--
<x-rich><color><param>0000,0000,8080</param>+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

</color><bigger><bigger>J</bigger></bigger>ames D. Patton
MSGID:JDPJ

<bigger><bigger>T</bigger></bigger>exas
<bigger><bigger>I</bigger></bigger>nstruments
<bigger><bigger>P</bigger></bigger>ittsburgh

Computer Operations           <bigger><bigger>S</bigger></bigger>ystems
<bigger><bigger>A</bigger></bigger>dministrator

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

</x-rich>



Sun, 09 Apr 2000 03:00:00 GMT  
 Opening a network connected drive from dos w/ perl



Quote:
> I currently running Win 95' and using the PC version of Perl. I was
> wondering if there is some way to have my perl script open up a network
> drive? I just wrote a very simple find script, I run it from c: and want
> it to connect to a network drive and exe. the script, and then post the
> results on c:......Is this possible?????

If you have 'attached' to that network drive, simply use the letter.

If you haven't, you might try using the network name.. something like
\\machine\share. I don't know if that will work through perl. You can
also use system calls to 'net use ...'.

Quote:
> open(LOG, ">c:\temp\find.log");   #putting the info on c:\temp

Just use '/', should work. If you prefer a backslash, you'll have to
double them, to escape them.

Also: ALWAYS, always check the return value of an open(). It might
give you a lot of information about WHY the open failed. Always run
perl with the -w option. Always use 'use strict'.

So, if your 'network' drive is t: (which might be mapped to anywhere):

#!/usr/local/bin/perl -w

use strict;
require 'find.pl';
# (I would prefer to 'use File::Find')
# ... Other code

open(LOG, ">c:/temp/find.log") or die "Cannot open file: $!";
find('t:/somewhere');

or, alternatively, but uglier

open(LOG, ">t:\\temp\\find.log") or die "Cannot open file: $!";
find('t:\\somewhere');

# Other code...

(silly MSDOS *sigh*)

Martien
--
Martien Verbruggen                  |
Webmaster www.tradingpost.com.au    | A Freudian slip is when you say one
Commercial Dynamics Pty. Ltd.       | thing but mean your mother.
NSW, Australia                      |



Fri, 14 Apr 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. open error on network drives

2. Perl, IIS, writing to network drives

3. perl, NT, IIS, can't get script to use network drive

4. Reading a networked drive

5. Connect to network printer with Perl logon script?

6. NT Script, Accessing network drives under scheduler

7. using network drives-newbee question

8. rename () makes files disappear on Win32 network drive?

9. PerlIS problem reading network drive

10. system() call won't work from network drive

11. NT and network drives

12. ActivePerl from a network drive?

 

 
Powered by phpBB® Forum Software