Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking for a file for current month and do FTP that to remote server

Status
Not open for further replies.

cts123

Technical User
Feb 28, 2007
108
IN
Hi,

Just wanted to check with you guys, if you have any script which does the check of a particular file in one location for the current month and do a FTP the same to a remote server.

Location of the file is = /int/PRD/400/fi_o/data/
File name = list_p0001709nvwr_CC_yyyymmdd.txt

Thanks a lot.

Regards,
Sam
 
If you can trust the timestap of the file then
maby something like this could be a startingpoint...

Code:
find /int/PRD/400/fi_o/data/ -type f -a -mtime -30 | 
  while read file
  do
    echo $file #print name of file
    # ftp it to where you want
  done
 
Presuming it's based on today's date, you can set the filename using something like:

[tt]FILENAME=list_p0001709nvwr_CC_$(date +%Y%m%d).txt[/tt]

Annihilannic.
 
Hi geirendre,

Thanks for your reply. But If I execute that command it is returning all files which are 30 days old.

I need file "list_p0001709nvwr_CC_yyyymmdd.txt" to select for the particular month and select that for FTP.

Say for example for Nov, the file would be like :-

list_p0001709nvwr_CC_20071108.txt

During Dec it may be :-

list_p0001709nvwr_CC_20071203.txt

So when I will execute the script for the month Nov or Dec or Jan, this will pickup the file of that particular month and then will do ftp. Hope you understood what I need.

And the job which creates the file is running only once in month.

Thanks.
Sam



 
In that case:

[tt]FILENAME=$(ls list_p0001709nvwr_CC_$(date +%Y%m)??.txt)[/tt]

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top