How can I make the process generate only the file or the files of today?



The everyday encrypted file comes to my server and I use Pgptool to decrypt it and save it as CSV file finally I upload it into a browser.
I did all the process and it works very well but I have some exceptions sometimes I receive more than one file or sometimes there is no file
how can I make the process generate more than one file if it exists?
how can I get all the files in today day?Please help :pray: :worried:

Hi @Imene_ZARAI,

You can try to put the files in a folder and then get the number of the files in that folder. Then you can loop using a while activity or a for each file activity - then it should generate more files. I don’t know if I understood your question properly.

To check if the file is from the current day you could try the DateTime.Now.ToString(“DATE FORMAT”) inside a if activity: if - condition.
To get more than one file try using a for each file activity.

I hope this helps.

1 Like

Hey @Imene_ZARAI

Just to explain at high level, make a loop and filter by date

Hope that helps

Thanks
#nK

1 Like

thank you for the reply
so I put all the process that I had already done in a foreach file loop and then I put it in an if -condition and check the existence of the file on this day
Did you mean that?

Try this to fillter

Directory.GetFiles(“YourFolderPath”).Where(Function(x) New FileInfo(x).LastWriteTime.Date > Cdate(“3/15/2021”))

1 Like

Yes. Something like CurrentFile.ToString.Containts("DateTime.Now.ToString(“DATE FORMAT”)) / CurrentFile.Name.ToString.Containts("DateTime.Now.ToString(“DATE FORMAT”))

1 Like

Please can you explain what you mean by Cdate(“3/15/2021”))?

sometimes the name of the file contains the date of yesterday or another date but It came to the server today so I have to get all the files of this current date

Hmm… if it’s not too much work then you could ask the person responsible with the files to send you a email with the names of the files.
Or if the process is automated then they could schedule emails.
Other than that you could make a data table that stores each file and then have the robot search for the file in that table and if it’s not in there perform the required actions and finally add it to the table so that it will skip it the next time you run the process.

Cdate() method convert string into date