File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Linux / UNIX and the fly likes Need help to Copy a File from Unix to Windows Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Need help to Copy a File from Unix to Windows" Watch "Need help to Copy a File from Unix to Windows" New topic
Author

Need help to Copy a File from Unix to Windows

Sam Saha
Ranch Hand

Joined: Jan 23, 2010
Posts: 104
I wrote a script which basically capture the necessary lines from the stack of a source file and dump them into a destination file in the same Unix server. I want to add script in my existing script so that instead of same server I can dump the output into Windows server(like C:\) or somehow I can copy that file from Unix to Windows. I am new in Unix scripting. I would appreciate if someone can help me writing the script.

Here is my script:



Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15952
    
  19

To transfer a file from one computer to another - regardless of what OS's are involved, you need either a file-transfer program or a file server.

Popular file-transfer programs include FTP servers, HTTP servers, rcp, scp and rsync. Just for starters.

A file server can be set up using Windows File sharing on the Windows side or on the Linux side, you can use Samba or NFS (although NFS requires you to install an NFS client on the Windows machine).

Pick one and we can help you use it.


Customer surveys are for companies who didn't pay proper attention to begin with.
Sam Saha
Ranch Hand

Joined: Jan 23, 2010
Posts: 104
Thanks. I want to use FTP. Please guide me how can I use ftp in my script to trasfer a file from Unix to Windows.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

First, you need to set up an FTP server in the Windows machine. Any version of Windows that contains IIS has an FTP server also available (this includes Windows Server and Professional).

Once that is set up, look at the man pages on your Linux box for the ftp command options for the command to place into your script.


JBoss In Action
Pradeep Kumar
Ranch Hand

Joined: Sep 08, 2006
Posts: 108
To transfer files between Unix and Windows you can install WinSCP tool which is a free tool. Once installed the files can be copied from and to Unix and Windows machine.

Regards,
Pradeep
http://www.unixonthego.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help to Copy a File from Unix to Windows
 
Similar Threads
Runtime getRuntime() exec(cmd[]) - How does this work?
getCanonicalPath() and getAbsolutePath()
Remote Debugging using Jbuilder X and Jboss 3.2.x
Class Not Found exception in cron job
Eclipse on Debian Sarge