Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google site



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-12-2007
Registered User
 

Join Date: Jul 2007
Posts: 217
File search variables

I have a remote server that generates files with name format:
Daily_Generated_File_11-14-07.txt.

The file name remains the same regardless, but the date portion at the end of the name will change (mm-dd-yy). Can someone supply a script that will search for files with the latest date based on the file name?
Sponsored Links
  #2 (permalink)  
Old 12-12-2007
porter porter is offline Forum Advisor  
Registered User
 

Join Date: Jan 2007
Posts: 2,965
How will the code get the list of files to search?

Could you not just start at today and work backwards?
  #3 (permalink)  
Old 12-12-2007
Registered User
 

Join Date: Jul 2007
Posts: 217
Quote:
Originally Posted by porter View Post
How will the code get the list of files to search?

Could you not just start at today and work backwards?

No this is something new, so it will search for files today going forward.
  #4 (permalink)  
Old 12-12-2007
porter porter is offline Forum Advisor  
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by bbbngowc View Post
No this is something new, so it will search for files today going forward.
So, today, you have files with tomorrow's date?

How does this code get the list of files?
  #5 (permalink)  
Old 12-12-2007
Registered User
 

Join Date: Jul 2007
Posts: 217
Quote:
Originally Posted by porter View Post
So, today, you have files with tomorrow's date?

How does this code get the list of files?
Huh? I think you miss understood.

I need the script to look in a remote directory for today's files. I came up with this and it works, but now how to I get this to run on a remote FTP Server

FILENAME="Daily_Generated_File_$(date +%m-%d-%y).txt"
find . -type f -name $FILENAME
  #6 (permalink)  
Old 12-12-2007
porter porter is offline Forum Advisor  
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Okay, it's FTP then.

I suggest you first use FTP to get a listing then enumerate through that listing and decide which is the latest.

Then when you know the name, use get to download it.

Whether you use two ftp sessions or one depends on how fancy you want to do your coding.
  #7 (permalink)  
Old 12-13-2007
Registered User
 

Join Date: Jul 2007
Posts: 217
Quote:
Originally Posted by porter View Post
Okay, it's FTP then.

I suggest you first use FTP to get a listing then enumerate through that listing and decide which is the latest.

Then when you know the name, use get to download it.

Whether you use two ftp sessions or one depends on how fancy you want to do your coding.
Sounds about right.

Now, if only someone would be so gracious as to get me started on this ..
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell script to search for text in a file and copy file imeadows UNIX for Dummies Questions & Answers 9 11-12-2008 09:12 PM
reading from a file and pass as variables and ignore # in the file konark Shell Programming and Scripting 4 11-08-2007 03:55 AM
search for the contents in many file and print that file using shell script cdfd123 Shell Programming and Scripting 3 10-07-2007 11:17 PM
Ksh script - Design ? - Search file and set variables littlefrog Shell Programming and Scripting 9 10-04-2007 04:16 PM
How to search a pattern inside a zipped file ie (.gz file) with out unzipping it senraj01 Shell Programming and Scripting 2 04-26-2006 05:32 AM



All times are GMT -4. The time now is 12:25 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2010. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0