Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Copying files to another server

by Scarborough (Hermit)
on Feb 17, 2005 at 16:34 UTC ( [id://431993]=perlquestion: print w/replies, xml ) Need Help??

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

I have a perl script which currently lists files to a SPOOLLIB directory on the same server. However we now have a requirement to send the files to a dedicated print server over a windows network.

I have used a

$result = system "net use b: \\\\printserver\\d$ $password /USER:$user +"; #copy the files $result= system "net use b: /DELETE";

command to share the directory and then copy files,it works, but this is not really satisfactory for a number of reasons.

Can anyone tell me the best way to achive this in perl?

Replies are listed 'Best First'.
Re: Copying files to another server
by ZlR (Chaplain) on Feb 17, 2005 at 16:54 UTC
    Hello,

    Which windows ?

    My Win2K has an rcp command, which does remote copy between systems.
    You could call it through system ...

    Also Win32::NetRessource (standard distribution module) can help you manage the net shares without resorting to net use and system calls.

    zlr

Re: Copying files to another server
by holli (Abbot) on Feb 17, 2005 at 16:54 UTC
    I guess the easiest way is to stick with a shared network drive. If you want something more perlish, there is
    Win32::DriveInfo to find out about free drive letters and
    Win32::NetResource to establish a connection to a remote server.


    holli, /regexed monk/
Re: Copying files to another server
by Jaap (Curate) on Feb 17, 2005 at 16:42 UTC
    You could use FTP or SCP or some win32 specific protocol. First choose a protocol and then find a perlish way to do it.

    If you want to keep using the win32 method you are using now, i don't think (perl|some module) can do a better job at it.
Re: Copying files to another server
by naChoZ (Curate) on Feb 17, 2005 at 18:37 UTC

    I've never used the windows version, but you can use rdist in conjunction with ssh. Something along the lines of:

    /usr/local/bin/rdist6 -P /usr/local/sbin/ssh \ -p /<path on remote machine>/rdistd -R \ $@

    Unison has a windows version also.

    --
    "This alcoholism thing, I think it's just clever propaganda produced by people who want you to buy more bottled water." -- pedestrianwolf

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://431993]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-03-28 10:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found