If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > how to read files with dates in filename

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-26-11, 02:43
samsince85 samsince85 is offline
Registered User
 
Join Date: Apr 2011
Posts: 5
how to read files with dates in filename

I have a shell script which should read file in a shared area with date in filename.

e.g: filename : abc_26042011.csv

shell script generated by tool that I am using :
SET LOAD_FILE="<Directory Path>\abc_26042011.csv"

Since there will be new file everyday, how can I modify this script to take filename with latest date?
Reply With Quote
  #2 (permalink)  
Old 04-26-11, 03:08
pdreyer pdreyer is offline
Registered User
 
Join Date: May 2005
Location: South Africa
Posts: 1,268
In unix shell
LOAD_FILE="dirpath/abc_$(date +%d%m%Y).csv"
or
LOAD_FILE="dirpath/abc_`date +%d%m%Y`.csv"

However it seems you are not using unix shell
Reply With Quote
  #3 (permalink)  
Old 04-26-11, 03:18
samsince85 samsince85 is offline
Registered User
 
Join Date: Apr 2011
Posts: 5
Thanks for that ...

I tried but both the cases it gives me file not found error
File "H:\Spend_tree_exports\SPT_EXPECTION_LOB_INDIRECT_ $(date +mY).csv" was not found.


I am basically using a DW tool that automatically generate scripts as below for loading process

@echo off
setlocal enabledelayedexpansion
setlocal enableextensions


SET LOAD_FILE="H:\Spend_tree_exports\SPT_EXPECTION_LOB _INDIRECT_$(date +%d%m%Y).csv"
Reply With Quote
  #4 (permalink)  
Old 04-26-11, 03:46
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
You are talking about batch programs on Windows - not shell scripts, right?
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On