Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
tsoley9262
Contributor III
Contributor III

Load Most Current CSV File

I am using csv files that are run every day and stored in a folder with the same name but with todays date, so I am trying to just pick the most current date to load ... below is the script I am working with.

LOAD [UCS Domain] as 'CAV CS Domain',
Org as CAVLOB,
[Host Name] as CAVHostName,
[Hardware Status] as CAVHardwareStatus,
[SAN Name] as CAVSANName
FROM
[\san$\SAN-Fabric-Refresh\VSI-Pending-Reboots\AP-HK-Cavendish\hkcdhvsi.pending-reboots.2020-01-31.csv]
(txt, codepage is 28591, embedded labels, delimiter is ',', msq);

3 Replies
neelamsaroha157
Specialist II
Specialist II

May be you can create a script variable that stores the date like vDate = Date(Today(), 'YYYY-MM-DD') and then when you are loading the file you can use this variable. 

Something like - 

FROM
[\san$\SAN-Fabric-Refresh\VSI-Pending-Reboots\AP-HK-Cavendish\*vDate *.csv]
(txt, codepage is 28591, embedded labels, delimiter is ',', msq);

tsoley9262
Contributor III
Contributor III
Author

Thank you I will give this a try!!

Brett_Bleess
Former Employee
Former Employee

Another option might be to create an 'archive' folder where you run an external command in our script to RoboCopy the new file to the archive after you have read it such that you only have to worry about the new single file etc...

Be sure to return to the thread if the other poster's response worked for you, use the Accept as solution button on their post to mark it, otherwise leave an update on things.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.