Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2011
    Posts
    5

    Unanswered: 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?

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    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

  3. #3
    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"

  4. #4
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    You are talking about batch programs on Windows - not shell scripts, right?
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •