1752650 Members
5348 Online
108788 Solutions
New Discussion юеВ

Re: Need ftp script

 
Vishal_1980
Regular Advisor

Need script

Hello experts--

 

I require one script for file copying from local server to FTP.

 

Thanks ,

 

Vishal

29 REPLIES 29
Vishal_1980
Regular Advisor

Re: Need ftp script

Hello : i will explain the scenario,

 

Pls check attacment & suggest me.

Hope some will provide me the solution ,as i am new to scripting.

 

 

Thanks in advance

 

Dennis Handly
Acclaimed Contributor

Re: Need ftp script

Any reason you provided an Excel file?  Is this how you need to get your script input of is this just how you wanted to present your requirements?  (Here a text file is better.)

 

If this is a one time thing, you can just code these values in a script.  Or copy the script and change them.

Or you can pass them as parms to the script.

 

#!/usr/bin/ksh

 

# ftp files from SRC_PATH/SRC to TGT on SERVER.  Using USER & PASS

 

SRC_PATH=/usr/sap/RAV/SYS/global/ftp/RMPA

src="RAV_INFO_20*"

TGT=/

SERVER=10.10.10.31

USER=dewqv

PASS="password"

 

ftp -inv $SERVER <<EOF
user $USER $PASS

bin

lcd $SRC_PATH

cd $TGT
mput $src
bye

EOF

Vishal_1980
Regular Advisor

Re: Need ftp script

Thanks a lot sir.....& sorry for puting the excel ...next time i will remember this definately..

However what if i want multiple file to be transfered from HP-UX to windows box.

As this is for the same purpose.We need to transfer few files more than six files from HP-UX to windows bos.

Please suggest me furthere & once again thanks for the guidence.

 

Regards,

Vishal

Vishal_1980
Regular Advisor

Re: Need ftp script

Dear sir..

 

I creates the script & run on the test server ....i below is the output ..

 

 

# ./ftpcptest
Connected to 10.10.10.31.
220-FileZilla Server version 0.9.41 beta
220-written by Tim Kosse (Tim.Kosse@gmx.de)
220 Please visit http://sourceforge.net/projects/filezilla/
Remote system type is UNIX.
331 Password required for dewqv
230 Logged on
200 Type set to I
Local directory now /sapmnt/RAV/global/ftp/RMPA
250 CWD successful. "/" is current directory.
(local-files) local: bye remote: bye
bye: No such file or directory
221 Goodbye
#

 

Please suggest .....

 

Thanks

Vishal

Vishal_1980
Regular Advisor

Re: Need ftp script

Dear sir ,

 

i need to move the below mention file

 

 

# pwd
/usr/sap/RAV/SYS/global/ftp/RMPA
# ll
total 12
-rw-rw----   1 rdvadm     sapsys         146 May 27 15:04 RAV_INFO_20140527_001.PSV
-rw-rw----   1 rdvadm     sapsys        2692 May 27 15:02 RAV_MM_20140527_001.PSV
-rw-rw----   1 rdvadm     sapsys          92 May 27 15:03 RAV_VM_20140527_001.PSV

 

thanks ,

Vishal

Dennis Handly
Acclaimed Contributor

Re: Need ftp script

>I need to move the below mentioned file: RAV_INFO_20140527_001.PSV

 

I assume you only wanted this one?

 

It appears that the forum changed my "src=" to lower case.  It tried to edit it several times and each time it did it again.

So I changed both to "src".

Vishal_1980
Regular Advisor

Re: Need ftp script

Yes sir..i got that & made the changes now it is successfull.......attached is the output

 

therefore i need to move 6 files at a time (all are different name) what changes i need to do in the script pls suggest...

 

 

Thanks ,

 

Vishal

 

Dennis Handly
Acclaimed Contributor

Re: Need ftp script

>made the changes now it is successful. attached is the output

 

(If you are happy with the answers, please click on the kudos star for each helpful answer.)

 

If you don't want so much output, you can remove that "v" in -inv.

Also, this script doesn't really catch errors too well.

 

>therefore i need to move 6 files at a time (all are different name)

 

Do you have a file matching pattern that will do all 6?

Otherwise you can just include all of them in:

src="file1 file2"