script for download files from ftp site


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script for download files from ftp site
# 1  
Old 09-18-2008
script for download files from ftp site

I'm new to scripting. I'm trying to write a script to download files from ftp site, the following is the script and the message i get after running the script. no files were downloaded Smilie
Thanks advance!

script:
#!/usr/bin/ksh
DAY=`date --date="-1 days" +%y%m%d`
ftp -v -n "ftp.address" << cmd
user "user name" "pass word"
cd /directory
prompt
bin
mget $DAY*
quit
cmd

Message after running the script:

Connected to lnxftp.mer.com.
220 Welcome to the Mer FTP Service.
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
331 Please specify the password.
230 Login successful.
250 Directory successfully changed.
Interactive mode off.
200 Switching to Binary mode.
221 Goodbye.
# 2  
Old 09-18-2008
try this....
Quote:
ftp -inv "ftp.address" << EOF
quote user username
quote pass password
.
.
.
# 3  
Old 09-18-2008
Thanks for your help.Smilie It works now.
# 4  
Old 09-19-2008
the following script works yesterday, but today does not work any more, what's wrong with it. after run it, it give me the same message as i posted before. please advise. thanks

#!/usr/bin/ksh
DAY=`date --date="-1 days" +%y%m%d`
ftp -v -n "fftp.address" << cmd
quote user username
quote pass password
cd /directory
prompt
bin
mget $DAY*
quit
cmd
# 5  
Old 09-19-2008
check the user name and password once again.. it might not be working.. try to login from command prompt..
# 6  
Old 09-19-2008
Thanks vidyadhar85, I can manually log on the ftp with the same user and pass. still don't know why it worked only yesterday Smilie

Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

To merge files on FTP site before getting them

I have a job that connects to FTP site, rename, get, delete a file and then process it. The renaming is done in consideration of this is one file name into which data is being accumulated many times within 24 hour cycle. This is what happens now: ftp -i $FTPHOST <<-EOF ren... (3 Replies)
Discussion started by: migurus
3 Replies

2. Shell Programming and Scripting

Curl ftp ssl download files

Hello all, I have been struggling with this issue on and off for a couple of weeks now and I just got it all working, so I wanted to share my findings in case some other poor soul needs to know how. First some background on what I'm doing. I am uploading files to different directories based on... (0 Replies)
Discussion started by: msjkadams
0 Replies

3. Shell Programming and Scripting

Download files every one second using ftp script

Our main Server "Srv1" is used to generate text files based on specified criteria and it is also connected to two clients (pc1 and pc2) which are responsible for getting the files from Srv1 as it follows: 1. pc1 ( which represents my UNIX machine ) uses shell script to copy the files from Srv1 2.... (3 Replies)
Discussion started by: arm
3 Replies

4. Shell Programming and Scripting

lftp script to connect to external sftp site and download to internal ftp and then send email

Hi there, I'm new to shell scripting and need some help if possible? I need to create a shell script (.sh) to run as a cron job on an ubuntu linux server to connect to an external sftp sites directory using credentials (which I have) and then download to our internal ftp server and then copy... (3 Replies)
Discussion started by: ghath
3 Replies

5. Shell Programming and Scripting

ftp - How to download files which created today?

Hello experts, I have written following script to download files which created today. Unfortunately, it's not working. test.ksh: #Defining variables USR='xxx' PASSWD='yyyy' HT='test.test.com' FILE='S*.pdf' XFILE=$(echo find . -type f -mtime 0) ZFILE=$(echo ls -tR|grep 'Jun 8')... (14 Replies)
Discussion started by: dipeshvshah
14 Replies

6. Shell Programming and Scripting

Expect - get, then move files within FTP site?

Trying to do the following, and it looks like Expect is probably my best bet. Any help greatly appreciated 1) Log onto ftp site 2) Go to folder 3) GET all files matching basename*.txt 4) MOVE those files to a subfolder on the ftp site. I don't need to move it on MY computer, I want to move... (2 Replies)
Discussion started by: mbourgon
2 Replies

7. Shell Programming and Scripting

Problem in Downloading one day old files from FTP site

HI, I'm downloading one day old files from ftp site. Below is my script ---------------------------- printf "open $HOST \n" > ftp.cmd printf "user $USER $PASSWD\n" >> ftp.cmd printf "bin\n" >> ftp.cmd #printf "cd /Models/\n" >> ftp.cmd printf "prompt\n" >> ftp.cmd printf "for oldfile... (4 Replies)
Discussion started by: shekhar_v4
4 Replies

8. Shell Programming and Scripting

Download previous day files through FTP

Hi All, I have a scenario where I need to download the previous day modified files from other server to my server through FTP . Could any one please send me the shell script for the same. I used the following but I dont know how to proceed after this. ftp -n -i -v $IP <<ENDOFinPUT >>... (3 Replies)
Discussion started by: sarathchandrach
3 Replies

9. Linux

shell script to download files from a site?

Hey everyone, my wife has purchased a bundle package of a bunch of images from a site, and now has to download each one of them manually. There are about 500 downloads, and it's quite a hassle to browse to each page and download them all individually. I would like to write a shell script to... (2 Replies)
Discussion started by: paqman
2 Replies

10. Shell Programming and Scripting

Pulling a list of files from FTP site in a shell script

Hi, I am writting a shell script which will pull a list files (mentioned in one file 1.txt) from external FTP site (for ex: ftp://abcd.efghijk.com/). The 1.txt is in my local unix directory. I have username and password to connect the external FTP site. Also before I pull the files, I need... (0 Replies)
Discussion started by: spatra
0 Replies
Login or Register to Ask a Question