Hello,
I am trying to get a report from a dynamic path, but the report also have a dynamic name.
I tried pulling the path from directory tool, but there are too many folders, subforders and files which takes a long time for directory tool to run.
I thought in using dynamic input to change entire file path, but I cannot think of a way to recognize the latest dropped file on certain day.
This is an example of what I am trying to do:
Under document folder there are many subfolders with lots of subfolders, but I am only interested in 'MathReport' folder, then today's date is 2023-03-08 I am interested in today's folder, in this case is '20230308' folder (Pic#1).
From many subfolders I only want to know about the files in the 'Summary' folder (Pic#2).
And I would like to select the oldest report for previous day, report name would be dynamic since it has time stamp. In this case, previous day file with the last dropped timestamp would be 'summary_report_20230307_200535' (Pic#3)
Pic #1
Pic #2
Pic#3
Thnak you in advance
Hi @ashamluo ,
You need to determine the latest file, correct?
Use the Directory tool to look into the "MathReport" folder. Ensure you have the "Include Subdirectories" box checked and you have narrowed down the name of the reports you want as much as you can (only the generic parts):
This will load in the metadata from these reports, including the date and time the file was created:
Sort by this field descending, then use a sample tool to select the first 1 record. This will be the latest file. You can repeat this process by using things such as datetimediff functions between this creation time and the current datetimenow() function. This will allow you to select the files you need. You then simply need a dynamic input tool to load these files in.
NOTE: If you don't want to use the created time field, you can simply parse the date from the filename.
I hope this helps,
M.