Operating System - HP-UX
1753781 Members
7702 Online
108799 Solutions
New Discussion юеВ

Re: script to ftp file from HP-UX server to a windows 2003 server

 
SOLVED
Go to solution
Helen Herring
Frequent Advisor

Re: script to ftp file from HP-UX server to a windows 2003 server

Mark, good idea.
My last attempt included the following:
In the unix script, I determined the file and then uncompressed the file on the unix server. Setting the variable again for just the uncompressed file name. Then the ftp portion of the script executed. It ran, but the total kb is different on the windows server than what is displayed on unix. I will look into your suggestion. I'm going to make a couple more tests but it looks like it is working. Like I said, I've just got to verify the ftp'd file size is correct. Anyway, I really appreciate yours and everyone's help. In researching, looks like the windows command to compress is compact? I'll give that a try. I want to automate all this.
Mark Landin
Valued Contributor

Re: script to ftp file from HP-UX server to a windows 2003 server

I wouldn't worry too awful much about filesizes matching exactly.

If you are dealing with text files, then you may need to do a "ux2dos" on the UNIX file first. If you are dealing with compressed files, like .Z or .gz files, then you may not need to uncompress them before sending them to Windows .. many of the Windows zip utilities will also read .Z and .gz files with no problem.

Don't forget to hand out points to all those people you are wishing to express your gratitude for. :)
A. Clay Stephenson
Acclaimed Contributor

Re: script to ftp file from HP-UX server to a windows 2003 server

Okay Kathy, I'll post the version of ftpput.pl that I typically use.

1) In your home directory (or the sender's home directory) create a file called .netrc with 600 (rw-------) permissions owned by the sender.
Have an entry like this:
machine remotehost login cstephen password topsecret account mostsecret

The account data is required on boxes which add an extra layer of authentication. You probably won't need that. Man .netrc for details.

2) cd to the desired directory on the local host

3) ftpput.pl -h remotehost -B -d dirname -t 4 -v file1 file2 file3
STAT=${?}

That will ftp to remotehost, attempt to login as the current user using password and account data in .netrc. -B specifies binary xfers, -d dirname cd's to dirname on the remote host, -t 4 tells it to try to send a file up to 4 times before giving up. -v set verbose. Finally, file1 file2, file3 are sent. You don't have to check file sizes or do checksums, if ${?} is zero then everything (login,hostname,xfers) was okey-dokey.

Invoke this puppy as ftpput.pl -u for full usage.
If it ain't broke, I can fix that.