Download previous day files through FTP


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Download previous day files through FTP
# 1  
Old 12-31-2008
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 >> ftpscript.txt
quote user $user
quote pass $password
passive
prompt
type binary
ls *.*
bye
ENDOFinPUT
exit;
# 2  
Old 12-31-2008
Quote:
Originally Posted by sarathchandrach
how to proceed after this.
You get the file listing so you can grep for timestamps which could be built something along the lines of like 'date "+%b %d" --date="1 day ago"'?..
# 3  
Old 12-31-2008
Thanks

for the reply.

As I am new to shell scripting I am unable to use the same.
Plz guide me how to use that list to get the files.
# 4  
Old 12-31-2008
Quote:
Originally Posted by sarathchandrach
As I am new to shell scripting
Then posting a solution wouldn't do you any good. Maybe first read some Bash scripting guides?:
BASH Programming - Introduction HOW-TO
Bash Guide for Beginners
(maybe save Advanced Bash-Scripting Guide for later).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. UNIX for Dummies Questions & Answers

List the files of previous day

I am using KSH. d=date | nawk '{ print $2,$3-1}' ls -lrt SystemOut* | nawk '/d/{print $NF}' I am trying to list the files of previous day but it doesn't seem to be working and i am also not getting an error. result is blank.Need help. (11 Replies)
Discussion started by: vagar11
11 Replies

4. UNIX for Dummies Questions & Answers

Move the files between Current day & a previous day

Hi All, I have a requirement where I need to first capture the current day & move all the files from a particular directory based on a previous day. i.e move all the files from one directory to another based on current day & a previous day. Here is what I am trying, but it gives me errors.... (2 Replies)
Discussion started by: dsfreddie
2 Replies

5. UNIX for Dummies Questions & Answers

current day remote files from FTP

Hi All, I have to work on a korn shell script to pick up only the current day files dropped on the remote server (using ftp). The file do not have daytimestamp on it. It has to be based on server time (AIX) The file naming convention is "test_file.txt" When I log in into the ftp account... (15 Replies)
Discussion started by: pavan_test
15 Replies

6. Shell Programming and Scripting

Script to check if last modified day is previous day

Hi, I would like to write a script that checks if a file ('counter') was modified the previous day, if so erase its contents and write 00000000 into it. For e.g. if the file 'counter' was last modified at 11.30pm on 24th May and the script runs at 12.15am of 25th May, it should erase it's... (1 Reply)
Discussion started by: hegdepras
1 Replies

7. 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

8. Shell Programming and Scripting

Script to find previous month last day minus one day timestamp

Hi All, I need to find the previous month last day minus one day, using shell script. Can you guys help me to do this. My Requirment is as below: Input for me will be 2000909(YYYYMM) I need the previous months last day minus 1 day timestamp. That is i need 2000908 months last day minus ... (3 Replies)
Discussion started by: girish.raos
3 Replies

9. UNIX for Dummies Questions & Answers

sample script to archive & move previous day syslog files

hi all. Please help me with archiving previous day syslog files. the files have no extension and have the format YYYY-MM-DD. I want to archive the file then move it to some other machine. thanks. (2 Replies)
Discussion started by: coolatt
2 Replies

10. Shell Programming and Scripting

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 :( Thanks advance! script: #!/usr/bin/ksh DAY=`date --date="-1 days" +%y%m%d` ftp -v -n "ftp.address" <<... (5 Replies)
Discussion started by: tiff-matt
5 Replies
Login or Register to Ask a Question