Open the oldest pdf

Hello,

How do I open the oldest pdf in a folder and get its name?

1 Like

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

1 Like

Hey @mario

You can try this:

`

FileSystemInfo fileInfo = new DirectoryInfo(directoryPath).GetFileSystemInfos().OrderByDescending(function(fi) fi.CreationTime).First()

Regards…!!
AKsh
`

3 Likes

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.

2 Likes

thanks a lot

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