Skip to Content

BODS - Multiple Flat Files - Selecting the Latest File

Hi BODS Experts,

We have two requirements in our Project.

Please help us how to resolve this.

Question 1:

We have multiple flat files naming  --> Data_<uniquenumber>.csv


Now I have to load data from only one flat file which is created/modified at the latest.


So Please help us how can we write Data Services script language for this scenario.



Question 2:


Once data from the file is loaded, the file will be moved to Archive folder.


After 30 days, the file would be deleted in Archival folder.


So Please help us how can we write Data Services script language for this scenario.


Thanks & Regards,

Muthuram.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Nov 04, 2015 at 12:26 PM

    Write  a command file (.bat file or shell script) to manipulate your files and call these from DS with the exec built-in function. Assign the return value (e.g. the filename) to a global variable.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 04, 2015 at 02:35 PM

    I will assume you are doing this on Windows, if not it's even easier.

    1. You can use something like this inside your batch script:

    for /f %%i in ('dir *.xml /b /o-d') do copy %%i current.xml & goto :moveit

    :moveit

    next operation...

    2. You can use this in your batch script to delete files in your archive directory older than 30 days

    forfiles /p \path\to\archive /d -30 /m *.xml /c "cmd /c del @path" 2>nul

    Add comment
    10|10000 characters needed characters exceeded