Copying files with certain conditions (if)

I am attempting to copy files with certain criteria from one existing folder to another, and then eventually rename. For now, I am focusing on copying the correct files. The criteria I am hoping to use is 1) if the file name contains “WTB Alt Invest” AND, 2) if the files is a .pdf AND 3) if the file was saved out today.

I have used several activities with no success. Any suggestions?

Hi @audra.swope

filteredFiles = Directory.GetFiles("C:\SourceFolder").Where(Function(file) file.Contains("WTB Alt Invest") AndAlso file.EndsWith(".pdf") AndAlso File.GetCreationTime(file).Date = DateTime.Today).ToList()

Regards,

Thank you all for your help. I will keep your suggestions handy for future processes. I ended up using the following flow:
For each current file in selected folder → if current files name contain “xyz” AND current file name contains “xyz”, then, copy current file full name to selected folder.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.