How to find files with dynamic file names

When you click the button, it is a file saved directly in the Downloads folder. It tries to find this file and move it to another folder, but the file name is variable every time you click (Ex: PurchaseOrderDetail_06_15_2020 11_48_29.xls). This will change PurchaseOrderDetail_06_15_2020 12_44_78.xls.
In the file name, you can specify the date and time as datatime, but do you need to * handle the rest of the part? Is there another way?

@111398 Can you try this expression :
Directory.GetFiles(“yourDownloadsFolderPathh”).OrderBy(Function(x)new FileInfo(x).CreatedDate).First

2 Likes

There is an error.

@111398 Looks like a namespace Error, Try this :
Directory.GetFiles(“yourDownloadsFolderPath”).OrderBy(Function(x)new System.IO.FileInfo(x).CreatedDate).First

Hi,
If you have the file name with ‘PurchaseOrderDetails_’ is common for every file, Yes you can use the * for file name. You can move the file to your required destination folder.
Please find the attached file for reference.Main.xaml (5.9 KB)

I Hope It can help.