For each- To move latest file to specific folder

Hi All,

Getting the following error while using For each activity to move a file Source folder to the Destination folder.

For Each: Unable to cast object of type ‘System.Char’ to type ‘System.String’.

Changed Type Argument as String in For Each

Hi @Pavan_kumar15,

May i know what was value inside the Folder_dir Variable. Can you please more elaborate

[Note: To Search Something inside from folder - Directory.GetFile(“Folder_Path”,*)

  • (Wildcard) - Indicate Name & Format]

Thanks in advance,
Jayavignesh G

Hi @Jayavignesh_G ,

Directory.GetFiles(Folderpath,“*.png”).OrderByDescending(Function (f) New FileInfo (f).LastWriteTime)(1)

Hi @Pavan_kumar15,

If you want to search file from respective folder using desc then try use the below


Thanks in advance,

1 Like

Thanks @Jayavignesh_G.

It’s working!

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