I have a folder where daily files gets saved.
the files has different name and format but ends with date in the format YYYYMMDD
I want to read files for the current day and the day before - so 20221031 and 20221029
In the directly tool under file specification how can I make the date part dynamic to read only the files with these too dates rather than reading all the files?
This will be linked to dynamic input tool to link similar files so I will have to create multiple workflow to do this I guess.
Thank you for your help.
Hi @Jaspal80
It's not possible to make the Specification section dynamic as far as I'm aware.
You can use a wildcard (*) to bring in all and then perform the filtering to just the files you want after the Directory tool.
Hi @Jaspal80 ,
I made two action tools connected to two directory tools. You can union the output of those tools to get only today and yesterday :-).
If you then make batch macro's for each day you probably can do it in one workflow :-)!
Greetings,
Seb
Hey @Jaspal80, to tackle this I'd use a filter that gets today's (and therefore yesterday's) date, formats it to match your file names and then checks for their presence within the file names coming through from the Directory tool. You can see here that I have a bunch of files coming in here:
After applying the filter:
The expression I use in the filter is:
Contains([FileName], DateTimeFormat(DateTimeToday(),'%Y%m%d'))
OR
Contains([FileName],DateTimeFormat(DateTimeAdd(DateTimeToday(),-1,'day'),'%Y%m%d'))
Hope this helps to get you started! You mentioned the files having different formats etc and so you may need a batch macro rather than multiple dynamic inputs. Though this depends on the exact details of your requirement.
@Jaspal80 Would suggest a similar approach to use custom filter and read only those records which has current date and yesterday's date in it.