1 there are multiple text files in that how to get the latest modified text file based on date created/modified in a same folder
2 once get the latest text file (file contains inside data is like : date ended on 15/4/2021) if date ended on string is present at last line in text file then using that send one sample mail
ex : if (text file data is date ended on then trigger mail)
Use FileSearch activity - this activity will generate one excel file which contain files details include. File Name, File Path, Owned By, Creation Date, Last Modified At, File Size In KB, File Type
Use Advance loop - excel - this activity will help you to sort data in desc order based on column (Creation Date)
Within loop - store file path in first iteration and use Break loop activity to come out from loop
you will get latest file path.
Once you get the file name, remove additional charcters and then using the same path, read the content of your Notepad file by Another Powershell command
Get-Content filePathofTextFile
Then do a comparision check with your condition and send the mail as per the output.
If this solves your issue, please mark the answer as Solution.