Save pdf name

Hi,

Using: Directory.GetFiles(“YourFolderPath ”,“*.PDF”).OrderByDescending(function(x) new FileInfo(x).LastWriteTime).FirstOrDefault

To get the latest pdf from downloads but i want to save that name of the pdf in a variable how do i do that?

@RACHEL_PAUL

Use like this

Path.GetFileName( Directory.GetFiles(YourFolderPath","*.PDF").OrderByDescending(function(x) new FileInfo(x).LastWriteTime).FirstOrDefault)

Cheers

Hi @Anil_G

An error is occuring saying get file name is not a member of string.

@RACHEL_PAUL

Can you give like this please

System.IO.Path.GetFileName

Cheers

This works. thank you @Anil_G .

1 Like

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