Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Copy file to linux machine from windows

by Anonymous Monk
on Jan 11, 2010 at 09:24 UTC ( #816688=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks, I am having some files in a remote windows machine. I wanted to copy the files to my linux machine in which i am working. The copying should be done from the linux machine itself. How to do that using perl? Thanks,
  • Comment on Copy file to linux machine from windows

Replies are listed 'Best First'.
Re: Copy file to linux machine from windows
by arkturuz (Curate) on Jan 11, 2010 at 09:50 UTC
    There's a zillion ways to do this, but if you want to do this strictly using Perl programming, then I would suggest a combination of openSSH server for windows on windows side, and a Perl application using modules like File::Remote or Net::SSH on linux side. I haven't tried that though, but linux+linux situation works great. Also, you could install some file-sharing support (Samba, for example) on Linux - it's much easier, and no programming involved. Or you could use Opera Unite :)
Re: Copy file to linux machine from windows
by Utilitarian (Vicar) on Jan 11, 2010 at 09:44 UTC
    What services are running on the windows machine (ie how is access to the file to be gained) ?

    print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."
      to be more clear, i am using putty to access linux machine. Is it possible for me to copy some files present in the windows machine from which i am using putty to the linux machine??I wanted this to be done from putty itself and i dont want to copy it using winscp.
        You'll need to use PSCP or PSFTP
        I have a couple of *nix machines I transfer files to/from. I currently don't have a need to do this in a completely automated way (may in the future).

        I use the FireFTP plugin to Firefox browser for file transfer and putty for command line stuff (like run the program when it gets to the server/other machine).

        FireFTP gets you a graphical "drag and drop" interface that is pretty smart. You can also sync directories and directories + sub-directories. And some other fancy stuff that I haven't needed yet.

        Anyway, I just click on FireFTP, click on connect to server and then move stuff around and rename, etc. in a similar way to the Windows graphical interface. I find this combination of graphical file transfer window and command line putty window to be fine.

        Update: I keep both windows open at the same time. Also, I can open a file on the remote *nix machine in one of my local Windows editors without "moving the file" manually. I just right click and use "Open With..." menu. So I can edit say a Word .doc file on the server without having to explicitly download it, edit it and move it back. When I "save the file", the WinWord changes get updated on the server. For something like that, this looks very much like a local file. If this is what you need to do, I highly recommend it.

Re: Copy file to linux machine from windows
by hawtin (Prior) on Jan 11, 2010 at 15:06 UTC

    There is more than one way to do it. Personally I have Cygwin on the PC and from a Cygwin shell do something like:

    Prompt: cd d:/temp/tt Prompt: tar cf - mydir | ssh -l web "(cd /tmp;tar xvf -)" Password for web on elrond: *****

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://816688]
Approved by Corion
[thezip]: G'day monks!
[thezip]: There's a word I'm looking for, which describes the (lack of) repeatability of an instruction. Specifically, when a command is run the first time, it succeeds, but then every subsequent execution of the same command results in an identical result...
[thezip]: What is the name of this property?
[marto]: /mewaves
[marto]: /mefails
[thezip]: Duh... I found it. Idempotentcy
[thezip]: howdy marto!

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2018-07-18 20:33 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (395 votes). Check out past polls.