Studio

Hi Team,

Always when i download file from web , my file will be getting downloaded .But my file name is not constant. But always my file name starts with Employee.
I want to pick the recent download file from my downloads folder and move it to different path.
I know how to use move file option but i dont know how to assign dynamic file name (logic)where to use. Please can you help me on this with clear explination or posting the image.

ex: file name: Employee_12569.xls,Employee_25698.Xls

To get the latest file name you can do like this:

String Latest_File_Name= directory.GetFiles(folder_path,“.xlsx”,SearchOption.AllDirectories).OrderByDescending(function(f) f.CreationTime).First()

Regards…!!
Aksh

Hi I have given the above code but it is showing error.

My req is My file name starts with employee and follwed by some random numbers, and it has to search the file name in the current folder only

I have taken assign activity and created “Dir” as ienumerable variable then in the right hand side i wrriten a code as

directory.GetFiles(C:\Users\rkolli\Downloads"employee*.xls",searchoption.AllDirectories).orderbydescending(function(f)f.creationtime).first()

it is showing error to me please help me with this

directory.GetFiles("C:\Users\rkolli\Downloads\","*Employee*.xls",searchoption.AllDirectories).orderbydescending(function(f)f.creationtime).first()

For your Reference check Here

1 Like

Thank you so much Aksh, It worked for me