![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| get latest file | inquirer | Shell Programming and Scripting | 4 | 04-02-2009 12:15 PM |
| Getting latest file from ftp | arunavlp | UNIX for Dummies Questions & Answers | 3 | 02-08-2008 10:19 AM |
| script to find latest executable in particular directory and start that particular ex | kvineeth | Shell Programming and Scripting | 6 | 09-24-2007 08:19 AM |
| Unix shell scripting to find latest file having timestamp embedded... | kaushik25 | AIX | 2 | 08-06-2007 11:42 PM |
| Reading file names from a file and executing the relative file from shell script | anushilrai | Shell Programming and Scripting | 4 | 03-10-2006 05:25 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Shell script to ftp latest file
Hello All,
Hope u r doing fine. I'm writing a shell script to ftp the latest file having pericular convention as 'ULTI_15072007043205.txt' on daily basis. Now the date & timing of the file geleration isnt constant, so the file name daily varies as per the date & timing of generation. Can anyone advice me how I can tackle with this? Shilpa |
|
||||
|
You use could 'ls' to return you the names sorted by date.
Quote:
|
|
||||
|
atomated ftp script, modify as per your request
#! /bin/sh
#Do an ftp and get the list of filenames starting with ULT ftp -ivn hostname <<INPUT >& out user rakesh Welcome ls ULT* bye INPUT #Obtain the latest filename inside the variable filename using sort command filename=`awk '{if($NF ~ "ULT") {print $NF}}' out | sort -r | sed -ne '1p'` #Do ftp again and get the desired file ftp -ivn hostname <<INPUT >& out user rakesh Welcome get $filename |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|