oh ok.
So you can use Directory.GetFiles() to get all files in that folder, whether it’s one file or not, it will still give you a list of files. But, you can hardcode the index as 0 if you only want to do the first one it finds.
I don’t recommend using local locations for data storage, unless it’s strictly for attended. But, I’ll use your path as a variable. Example shown below:
srcPath = "D:/ Mail_addaress /current_date"
srcFiles <Array Of Strings> = System.IO.Directory.GetFiles(srcPath, "*.pdf")
For each f In srcFiles
Read f
That’s just pseudocode to represent the logic needed.
If you don’t want to run a loop through each file it finds, then hardcode the index, like srcFiles(0)
, or even sort it and take the most recent file like srcFiles.OrderBy(Function(x) System.IO.File.GetCreationTime(x) )(0)
EDIT: added extension pattern to GetFiles() so it only finds pdf files.
Hope that answers it better.
Regards.