Bat/Shell file copy to Unix/Windows
NickName:Jack Ask DateTime:2011-03-02T16:27:09

Bat/Shell file copy to Unix/Windows

I got the task to write a script to do some tasks, one of those is to copy some files from the local machine to a server directory. Now this isn't exactly my area of expertise, so I was wondering if anyone could give me some advice/pointers.

They gave me the following requirements: 1) same script needs to be capable of copying to a Windows AND Unix machine 2) no files should be modified (such as .rhost) 3) Bat file for the Windows machines, Shell script for the Unix machines

It doesn't matter if I read whether the target machine is Windows/Unix from the command line so an if/else is possible.

But I have no idea on how to start with this without having to modify the rhost file so any input is appreciated.

Copyright Notice:Content Author:「Jack」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/5165049/bat-shell-file-copy-to-unix-windows

Answers
Ocaso Protal 2011-03-02T09:06:32

As long as it as internal network (= security assumptions aside) I would set up a FTP server on the server side and use ncftp on the client side to connect to the server.",


Jeremiah Willcock 2011-03-02T08:41:28

Can you use something like scp or sftp (the SSH tools for file transfer)? They are cross-platform, but you will need to set up keys and an SSH server on the destination of the transfer.",


More about “Bat/Shell file copy to Unix/Windows” related questions

Bat/Shell file copy to Unix/Windows

I got the task to write a script to do some tasks, one of those is to copy some files from the local machine to a server directory. Now this isn't exactly my area of expertise, so I was wondering if

Show Detail

Pass unix line separator in a Windows bat script to java.exe

How do I pass in the unix line separator to Java.exe on Windows. I tried this -Dline.separator=\n it doesn't work. I am on Windows, I run cmd.exe, then I run a bat file. I want to pass in the unix ...

Show Detail

copy a file to unix server from windows shared folder using unix command

copy a file to Unix server from windows shared folder using unix command Example:- A shared drive on windows is- hostname\folderName and it contains a file name Test.txt inside it. Now I want to c...

Show Detail

Windows TYPE to Console recreated using Unix Shell scripting

We have simple Windows batch files that when an error occurs, an "ONCALL.bat" file is run to display support information that is maintained in a separate oncall.txt text file. This is our SOP. ONC...

Show Detail

Unix Shell script to copy files from unix location to windows FTP

Could anyone provide me Unix shell script to copy files from unix location to windows FTP location. Thanks, Chaitu

Show Detail

Execute bat file with unix credentials and file transfer to UNIX box in javascript

How can I execute bat file from windows with credentials. Checked this solution and just curious how to pass the credentials to login to unix server and then do some steps using bat file? fs.chmodS...

Show Detail

Unix shell command for moving all files other than *.bat to a different folder

Unix shell command for moving all files other than *.bat to a different folder. Here in a single folder many file are present and only *.bat files need to be kept rest all need to ne moved to a

Show Detail

Convert Unix Shell Script to Windows Batch File

I have a shell script (.sh) that works in Unix but I'd like to convert it into a Windows batch file (.bat): cat >flog.ctl <<_EOF LOAD DATA INFILE '$1.log' "str ';'" APPEND INTO T

Show Detail

Copy file from UNIX to Windows using script

I would like to write a script to automate a task which I do manually everyday. This task requires me to download some files from a UNIX server (Solaris) to my desktop (Windows XP) using WinSCP. Is...

Show Detail

How to run a windows bat file from unix script

Could you help me run the windows bat file from unix script ftp_data() { ftp wsapp00012.srv.dir.abc.com << EOF prompt off asci cd photo cmd Photo_load.bat quit EOF } ftp_data

Show Detail