download specified file from ftp server


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting download specified file from ftp server
# 1  
Old 06-25-2008
Question download specified file from ftp server

Hi all,

I'm having problems downloading files from ftp server. I have to download only those files that name starts with YYYYMMDD.But file comes like the format "20080624221035.TXT".Also how i can get list of all file names with in specified folder.

Here i paste my code

ftp -vn servername<<SCRIPT

user username password

binary

get $source $target

bye

SCRIPT

Do you have some source code sample or any idea ?

I am using simple shell script.

Thanks!
vaskar
# 2  
Old 06-25-2008
#!/bin/sh

echo "Enter date:"
read date_now

ftp -idn << !
open <IP Address of the target server>
user (username password)
cd (directory where the desired files exist)
mget ${date_now}*
close
bye
!
justsam
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unable to Download File from FTP

Hi, I am trying to download files from FTP using below FTP code. x=$(TZ=CST date +%Y%m%d) host='xxx.xx.xxx.xxx' user='userX' pass='Password' echo "Connecting to FTP Host -- $host....." echo $x a=$(ftp -v -n -i << ! open $host user "$user" $pass cd /rose/yellow/ mget... (6 Replies)
Discussion started by: rramkrishnas
6 Replies

2. Shell Programming and Scripting

Update/Download file from FTP server to UNIX Server

HI Guys, I want to download files from FTP Server to my Unix server. I have tried , buy No Luck . Below Command i have tried. 1-Wget - Error "wget' not found" 2.ftp -n $HOST ...Not Working. 3.scp -i ftp://user:passowrd@hostname:21/ran/on/test.txt Any Suggestion (2 Replies)
Discussion started by: pareshkp
2 Replies

3. Shell Programming and Scripting

Read latest file name with a date and time and then download from FTP

Hi All, Please help. I have requirement to read the file / folder based on the latest date and download the file and folder. There will be files and folders in the location like 20140630-144422 20140630-144422.csv 20140707-182653 20140707-182653.csv 20140710-183153... (7 Replies)
Discussion started by: Praveen Pandit
7 Replies

4. UNIX and Linux Applications

Problem with Apache Tomcat FTP Server - download gets 404

Hi $ brew -v install tomcat Homebrew 0.9.5 ==> Downloading http://www.apache.org/dyn/closer.cgi?path=tomcat/tomcat-7/v7.0.53/bin/apache-tomcat-7.0.53.tar.gz ==> Best Mirror http://mirror.switch.ch/mirror/apache/dist/tomcat/tomcat-7/v7.0.53/bin/apache-tomcat-7.0.53.tar.gz /usr/bin/curl -fLA... (1 Reply)
Discussion started by: slashdotweenie
1 Replies

5. Shell Programming and Scripting

Wanted to download the yesterday's file through FTP

Hello, Wanted to download the yesturday's or current date-1 file through shell script Mode: FTP OS: AIX if today is 13th May then file would be available as below. File Pattern:201401148682_daily_2014-05-12.txt.zip Help.. (4 Replies)
Discussion started by: Riverstone
4 Replies

6. Shell Programming and Scripting

Download latest file via ftp server unix through shell script

Hello this is my first post in this forum , I dont want to be unhappy.. I am writing one script but facing difficulty to find the latest file with some new pattern My requirement is 1. The file is coming like "ABCD-23220140303" at FTP server once in a week. 2. script will run on daily... (3 Replies)
Discussion started by: ajju
3 Replies

7. Shell Programming and Scripting

FTP File download

Hi, I have few files at FTP location and have written a script to download the same from ftp based on the sysdate - 1, however with the below code I am unable to download the files from FTP. x=`TZ=CST+24 date +%Y%m%d` mget Daily_BIH_$x_NEW.tar.gz can anyone please help me in... (10 Replies)
Discussion started by: rramkrishnas
10 Replies

8. UNIX for Advanced & Expert Users

Want to download a latest file with current date from FTP location

Dear Friends, I need help to write a shell / perl script to download the files from FTP location, having different file names (date inside the file name). Example: Mar 5 09:24 cfx_03052013_return_file.txt Mar 6 02:13 cfx_03062013_return_file.txt Mar 7 06:40... (3 Replies)
Discussion started by: Praveen Pandit
3 Replies

9. Shell Programming and Scripting

Question about how to ftp download the latest file from a directory

Dear all, Hope you are doing well. I am in trouble to write a shell for ftp downloading the latest file from remote server. Situation: There is a directory named 'weekly' which contains .csv files with the following pattern: RES_EN_100417-080003.csv.Z. The new file is generated... (3 Replies)
Discussion started by: kel1014
3 Replies

10. Shell Programming and Scripting

How to download X bytes from a file using ftp or http?

Hi, I have a simple ftp shell script which can download the entire file, however I want to know if there is anyway that I can download only the partial content, say X bytes from a file. If so, how I can do it using ftp and http.. Here is my sample script #!/bin/sh HOST='xyz.com' ... (5 Replies)
Discussion started by: learn more
5 Replies
Login or Register to Ask a Question