Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
How to get latest folder
MY folder structure is like C: Xyz\2020\07\22\1120\abc.csv
so here 2020 is year , 07 is month , 22 is day and 1120 is HHMM(time)
so here in this 2020 folder we have a month name folder (ex. 07) and under month we have
7 folder of different different date (e.x 01,07, 06,17,15,18) and under this we have a folder with HHMM (ex 1120) and under this folder we have actual file, so my question is how to read latest date folder first and then latest time and then finally read the file. Please refer the screenshot for your reference
so from Screenshot 1 i want to take 18 , from screenshot2 i want to take 05 and then final file. please help
Hello,
One approch i can give you is this :
List all folder in "Xyz" with tListFile and choose only folder in selection list
Sorry for the french version (The first is to retrieve only file, then folder or both)
It's an iteration, use tIterationToFlow to catch all folders names (with global variable ((String)globalMap.get("tFileList_1_CURRENT_FILE")) ) cast this in tJavarow to transforme it to integer and use tAggregatRow to get the max. Store this in tSetGlobalVar
On subjob Ok
Use the same manip to get the last month then day. Dont forget to add in the second tFilelist the value of the last year in the current workspace like this
"C: Xyz\\"+((String)globalMap.get("lastYear"))+"
then
"C: Xyz\\"+((String)globalMap.get("lastYear"))+"\\"+((String)globalMap.get("lastYear")) on the 3d subjob
Dont hesitate if you have some question 🙂