I have a situation where I have a file which gets pasted into a folder location everyday. What I want to do is send out a mail if the file is not present today, in addition to that if the file is not present consecutively for 2 days I want to send out another email regarding it.
A Check on the file is present or not could be done with the following :
Directory.GetFiles("YourFolderPath","MER*").Any
The above would result true if any file of the same format is present in the folder specified.
The Consecutive days part needs more clarification, Is the Process being Scheduled for those two days, If so, there wouldn’t be a need to handle that, but if the Schedule Frequency is more and you would only want to send mails twice if not received, then an Asset could be used to mark the count. Also, are different emails to be sent ?
Case 1 :
Initial Run → File Not Present → Retrieve Asset value, value<2,Update Asset to 1 (Initially was 0) → Send Mail
Second Run → File Not Present → Retrieve Asset value, value<2, Update Asset to 2 → Send Mail
Third Run → File Not Present → Retrieve Asset value, value<2 (Results to False), Nothing to perform
Maybe the Reverting condition i.e Changing the Asset value back to 0 would need to be understood if that could be put in the Third Run’s condition i.e Value Greater than 2. But we do not know the full requirements yet, so do analyse and maybe provide us some more insights on the process and we’ll try to help you further.