Operating System - HP-UX
1833588 Members
4158 Online
110061 Solutions
New Discussion

Re: RCP from Unix to Windows NT

 
Fabrizio Alleva
Occasional Advisor

RCP from Unix to Windows NT

Hy, I've to copy a file from a Unix Machine to a Windows Machine into a script. How can I do that ?
Thank you
8 REPLIES 8
Michael Tully
Honored Contributor

Re: RCP from Unix to Windows NT

You would need to use ftp. If you had a product like 'exceed' that has a windows like interface it makes it easy. If you wanted to automate file transfers, netrc is probably the go.
Anyone for a Mutiny ?
Deepak Extross
Honored Contributor

Re: RCP from Unix to Windows NT

There are a number of commerically available FTP Agents - a search on your favorite search engine should throw up some.
These do fancy things like remembering connection profiles and passwords, besides giving you a user-friendly interface.
If you're looking for a quick bare-bones way to get your files across, just use ftp.
You may want to compress the files before ftp'ing and uncompress them at the other end. Also, have a look at the man page for ux2dos.
T G Manikandan
Honored Contributor

Re: RCP from Unix to Windows NT

Hello,
Just check this link
http://www.mkssoftware.com/products/tk/ds_tkdev.asp

Also you can use rcp.exe from NT to do the task.
i have not tried this/?


Santosh Nair_1
Honored Contributor

Re: RCP from Unix to Windows NT

If you need to transfer files usin rcp, then you'd probably have to initiate it from the NT side. Assuming that you have the .rhosts or /etc/hosts.equiv files set up properly, then you should be able to do the following from the NT machine:

rcp :

for example to copy /etc/hosts from machine1 to c:\temp, the command would be:

rcp machine1:/etc/hosts c:\temp

Hope this helps.

-Santosh
Life is what's happening while you're busy making other plans
harry d brown jr
Honored Contributor

Re: RCP from Unix to Windows NT

Personally, I'd load linux on the NT, then it wouldn't such an issue. But you could try some freeware products that allow the NT to accept file transfers, or use ftp. A second option, providing the two machines are within the same lan (and not on the internet) is to use samba on the HP, then the NT can just mount the fileshares.

live free or die
harry
Live Free or Die
Frank Slootweg
Honored Contributor

Re: RCP from Unix to Windows NT

See my response in the thread http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xc9560b0717d1d5118ff40090279cd0f9,00.html

That thread/response mainly talks about executing commands (i.e. r[em]sh(1)) instead of copying files, but what goes for r[em]sh(1), also goes for rcp(1).
Krishna Prasad
Trusted Contributor

Re: RCP from Unix to Windows NT

There are rcp products you can install on NT to allow you to use rcp to Unix environments..If you don't want to mess with that you can automate ftp scripts to move the files back and forth.

echo "
open hostname
user username password
get or put filename
close
" | ftp -i -n
Positive Results requires Positive Thinking
Geoff Wild
Honored Contributor

Re: RCP from Unix to Windows NT

You could also try samba (CIFS/9000) on your HP box, then write a simple bat file on your nt box to copy the file.

Here's a script you can try if you want to use ftp from Unix to NT:

#!/bin/sh
##########################################################################
# Shellscript: transfer.ftp - transfer a file using FTP
##########################################################################
# Description
# - transfers the file to the given host using FTP (binary
# mode)
# - To automate the transfer, a temporary file "$HOME/.netrc"
# will be created (if not already present)
##########################################################################

PN=`basename "$0"` # Program name
VER=`echo '$Revision: 1.3 $' | cut -d' ' -f2`

Netrc=$HOME/.netrc

if [ \( $# -lt 1 \) -o \( ! -r "$1" \) ]
then
echo >&2 "usage: $PN file [hostname] User"
exit 1
fi

File="$1"
Host="${2:-junior}"
Base=`basename "$File"`
User="$3"

# If $HOME/.netrc is readable and contains the target host name,
# try an automatic FTP transfer. Otherwise, create the file
# temporarily, and remove it later on.

[ -r $Netrc ] && grep "$Host" $Netrc > /dev/null || {
# User=`id | sed 's/uid=[0-9][0-9]*(\([^)]*\)).*/\1/'`
echo -n "$PN: password ($User@$Host): "
stty -echo
read PW || { stty echo; exit 1; }
stty echo
echo " OK"

if [ -r "$Netrc" ]
then # Create backup of old .netrc
mv "$Netrc" "$Netrc".$$
trap 'mv "$Netrc".$$ "$Netrc"' 0
else
> "$Netrc"
trap 'rm -f "$Netrc"' 0
fi
trap "exit 2" 1 2 3 15
echo "machine $Host login $User password $PW" >> "$Netrc" || exit 1
chmod 600 "$Netrc"
ls -l "$Netrc"
}

ftp $Host <
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.