Hello,
How do I open the oldest pdf in a folder and get its name?
Hello,
How do I open the oldest pdf in a folder and get its name?
You can search for the properties of files and use that to determine which is the oldest…
Use something like the following https://msdn.microsoft.com/en-us/library/system.io.file.getcreationtime(v=vs.110).aspx
Hey @mario
You can try this:
`
FileSystemInfo fileInfo = new DirectoryInfo(directoryPath).GetFileSystemInfos().OrderByDescending(function(fi) fi.CreationTime).First()
Regards…!!
AKsh
`
Thanks guys. FileSystemInfo fileInfo is my left side in action assign? So can I rename it for example to FileName? What kind of variable should be that?
Yes create a variable with name “fileinfo” with a data type System.IO.FileSystemInfo then assign the above thing and replace directory path with your directory path.
thanks a lot
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.