Need to copy a particular excel to destination

Hi everyone,

My requirement is there are multiple .xlsx files in a folder of different names
i need to search for excel files which are in dd-MMM-yyyy format and copy the oldest files

for eg : there are these excel files
1.sample.xlsx
2.sample1.xlsx
3.19-May-2022
4.12-May-2022
5.03-May-2022

i need to copy 03-May-2022 to my destination
@Palaniyappan @Gokul001 @Yoichi any suggestions
Thanks in advance

hey

can you try the following

image

Regards!

1 Like
  1. assign
    filesArray (Array of string variable) = Directory.GetFiles(folderPath)

  2. assign
    oldestFile (string variable) = filesArray.AsEnumerable().Where(function(file) Datetime.TryParseExact(path.GetFileNameWithoutExtension(file), "dd-MMM-yyyy",nothing, nothing, nothing)).ToArray.AsEnumerable().OrderBy(function(x) cdate(Path.GetFileNameWithoutExtension(x))).first

image

1 Like

@jack.chan it worked thanks!!

1 Like

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