how to get only leatest pdf files and that i have move in different folder but condition is i just want only pdf files not all what was the code i have to use
to get latest pdf file do this
Directory.GetFiles(str_folder,"*.pdf").OrderByDescending(Function(d) New FileInfo(d).CreationTime)(0)
where str_folder = your folder path
How about this expression?
Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)+"\Downloads").[Select](Function(x) New FileInfo(x)).Where(Function(f) f.Extension.Equals(".pdf")).OrderByDescending(Function(x) x.LastWriteTime).Take(1).ToArray()(0).ToString
I ll try
value of type string cannot coverted to 1-dimensional array of string
this error is occuring
@Suraj_Gaikwad_Nuvama_Grou what are you assigning it to? it has to be assigned to string variable
if you want to assign to array, change code to
Directory.GetFiles(str_folder,"*.pdf").OrderByDescending(Function(d) New FileInfo(d).CreationTime).ToArray
again same erroe for
i have to convert string to array
Check if you have the string array variable?
Can you share the screenshot for more info?
@Suraj_Gaikwad_Nuvama_Grou change to this code
yeah worked this thanks
issued solved but getting all files
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.