Hi All,
Suppose I have a folder with filenames like:
file_20241003xya.csv
file_20241002xbz.csv
file_20241001xyc.csv
file_20240930dyz.csv
file_20240927xez.csv
file_20240926fyz.csv
Suppose today's date is 07-10-2024. I want the workflow to check if file file_20241007 is there. If yes, use that file as input. If the file is not there, check if the file with date 06-10-2024 is available. If yes, use that file as input. If not, check if the file with date 05-10-2024 is available. And so on ...
Is that possible?
Thanks,
R.
Solved! Go to Solution.
Hey @RVDL, if I'm understanding your request properly, this should do the trick. The steps are:
1) Read in the list of files - you'll need to replace my Text Input with your Directory tool pointed at the target folder
2) Isolate the numbers in the filename and parse the date from these
3) Filter to ensure there's no files with a date beyond today - feel free to remove if this isn't a possibility
4) Sort the dates in descending order
5) Sample to isolate the latest
You'll then just need to add a Dynamic Input tool to the end of this short workflow to read in the file that ends up being selected.
Exactly what I was look for. Thank you.