how to ftp multiple files


 
Thread Tools Search this Thread
Operating Systems HP-UX how to ftp multiple files
# 1  
Old 11-30-2005
how to ftp multiple files

Hi,

I have to write a ftp script which transfers multiple files from one unix server to another. When I try to transfer single file it goes through successfully. But, When I try to do multiple files none of the files get ftp'd. And also, even the single file goes transferred successfully, I am getting an invalid command error.

Here is the ftp scripot I am using:

#!/bin/sh
HOST='xxxxx'
USER='xxxxx'
PASSWD='xxxxxx'
FILE='/UTIL/EDI/GEN52/test_box/geiss.*'

ftp -nv $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
cd send
FILE='/UTIL/EDI/GEN52/test_box/geiss.*'
binary
prompt off
mput $FILE
bye
##quit
END_SCRIPT
##exit 0

Please advise how to fix this.

Thanks,
Inder
# 2  
Old 11-30-2005
check out the "-i" option to ftp ...
# 3  
Old 11-30-2005
Hi,

Thanks for the response!!

But isn't the -i is for disabling interactive processing. But In this case, I am not even getting a single file ftp'd.

Thanks,
Inder
# 4  
Old 11-30-2005
i just looked at your code again and see that you're actually using a wildcard --- try specifying the files ... and yes --- i did mean to use the "-i" option ...
# 5  
Old 11-30-2005
Try using this code:
Code:
#!/bin/sh
HOST='xxxxx'
USER='xxxxx'
PASSWD='xxxxxx'
FILE='geiss.*'

ftp -inv $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
cd send
lcd /UTIL/EDI/GEN52/test_box
binary
prompt off
mput $FILE
bye
##quit
END_SCRIPT
##exit 0

If an absolute source file path is specified to ftp, then it tries to put the file to the same path on the remote server. I think that's where the script is failing. (Atleast it failed for me!)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

FTP Script for Multiple Files of Same Name

Hello! I'm having a bit of trouble coming up with a script that can connect to 3 different log boxes and pull down files for that day into a single directory, where the files will all have the same name as per: stats_websites_20150801010000-20150801015959.csv.gz... (2 Replies)
Discussion started by: Cludgie
2 Replies

2. Shell Programming and Scripting

Ftp multiple files one at a time

Hi, I have a problem while ftp'ing zip files one after the other from linux source directory to a ftp host machine. here is the shell script: #!/bin/ksh dir=data/dir1/dir2 # this dir is linux source directory where zip files located. rmtdir='/home/' echo $dir for i in /$dir/*; do if ;... (7 Replies)
Discussion started by: raj78
7 Replies

3. Shell Programming and Scripting

Transfer multiple different files in FTP

Hi All, i am doing ftp how can i transfer multiple different files example- 03-21-13 06:33AM 46800 CATT_HOURS.pgp 03-21-13 06:33AM 266392 CATT_TAX.txt 03-21-13 06:33AM 91448 CATT_STATUS.txt 03-21-13 06:33AM 468 ... (3 Replies)
Discussion started by: krupasindhu18
3 Replies

4. Shell Programming and Scripting

ftp multiple files at the same time

Hi All, I am using ncftpput in one of my c-shell script to upload files to a remote location. The source files keep coming continuosly and to upload each file ncftpput opens a new connection everytime. It means ncftp uploads the file1 than file2 than file3 .... There is gap 20-25 secs between... (10 Replies)
Discussion started by: sraj142
10 Replies

5. Shell Programming and Scripting

FTP multiple files from multiple directories

I have multiple files that starts as TRADE_LOG spread across multiple folders in the given structure.. ./dir1/1/TRADE_LOG*.gz ./dir2/10/TRADE_LOG*.gz ./dir11/12/TRADE_LOG*.gz ./dir12/13/TRADE_LOG*.gz when I do ftp uisng mput from the "." dir I am getting the below given error mput... (1 Reply)
Discussion started by: prasperl
1 Replies

6. Shell Programming and Scripting

To remove multiple files in FTP

We have a files in FTP server..... after getting the files from FTP by mget *.* i hav to remove all files (multiple files) at once... is there any command to delete multiple files at once (2 Replies)
Discussion started by: nani1984
2 Replies

7. IP Networking

Automated ftp for Multiple files

I have seen the script posted yesterday for automated ftp Can we do some thing like ftp ing multiple files in one script Example input.txt has all files names to be ftped input.txt ------ a.tar b.ccp c.perl i need to ftp all the files present in input.txt i tried something like... (0 Replies)
Discussion started by: pbsrinivas
0 Replies

8. Shell Programming and Scripting

deleting multiple files through ftp

Hi, I have a situation where I need to delete multiple files from a folder once I connect to FTP server. I am using ftp script to get the files, number of files always vary from 1 to 100. once I get the files I need to delete all the files downloaded I am making a list of all the files... (4 Replies)
Discussion started by: mgirinath
4 Replies

9. Shell Programming and Scripting

Need to send multiple files during ftp

Hi guys... I'm working on #!/bin/sh script in a Solaris 7 box that should send several files over to another machine via FTP. Here's what the script looks like: # This script will send the daily MSP customer counts # to the Crystal Reports server located at 192.168.2.106 cd... (2 Replies)
Discussion started by: cdunavent
2 Replies

10. Shell Programming and Scripting

FTP multiple files to different directories

The script below is written to ftp files to different directories on the destination server, but I'm not sure whether I have written the code correctly or not. Can anyone help me on this? #!/bin/sh FILE_NAMES="FileA FileB FileC" SERVER=xxxx USERID=abcd PASSWD=xxxxx... (12 Replies)
Discussion started by: abrd600
12 Replies
Login or Register to Ask a Question