Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everybody,
I have a new problem and I think you guys will be able to solve it with me.
I have one folder (name: extract) , which is full of monthly extractions (names: 201407,201408,201409,...). In each folder, I have one file (name: Product.csv) and I want to select the file 'product' in the last folder (the new one) each month.
So, I want my script like that:
LOAD
@1
@2
@3
@4
from ['The file Product.csv from the last folder']
I tried something else with:
for each File in filelist ('G:Extract\*') But I don't know how to select the last folder...
If someone knows how to solve it... and wants to help a poor newbee
Thanks
Louis
or:
Step 2:
FOLDER_table:
load
right(dirname,len(dirname)-Index(dirname,'\',-1)) as folder_name Resident DIRNAME;
folder_list:
NoConcatenate
LOAD folder_name Resident FOLDER_table Order BY folder_name;
drop Table FOLDER_table;
and you should have now the list of your folder order by asc.
You chosse the last one by peek function in a variable and use the variable in your Load* from...
but not sure it's works. depending your folder_name list....
Final step should be:
let vfolder=Peek('folder_name',-1,'folder_list');
DATA:
LOAD * From 'G:\Extract\'$(vfolder)'\Products.csv'
Thank You so much desmoutier & Gysbert !!!!
It works soooo well
Thank you for your help