How to pick up the latest downloaded file from downloads

Hi all,

I am able to download the excel file from the website and storing into downloads section.
Once the file downloaded the file name will be InvoiceFrontPage then InvoiceFrontPage (1),
InvoiceFrontPage (2) and goes on.
In one execution only one file gets download.
How to pick the latest downloaded file and rename and then move to particular folder.
Please help me how to do this, thanks.

Regards,
Lakshmi

Hi @lakshmi.mp

How about this expression?

sPathDownload | DataTable → String

sPathDownload = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)+"\Downloads").[Select](Function(x) New FileInfo(x)).Where(Function(f) f.Extension.Equals(".xlsx")).OrderByDescending(Function(x) x.LastWriteTime).Take(1).ToArray()(0).ToString

Note → Update extension in the above query

Regards
Gokul

1 Like

Hi @lakshmi.mp ,

try to user “Wait for Download” activity

Thanks,
RajKumar

Hi @Gokul001 ,

Able to pick the latest file from downloads, how to rename the latest file to Tool dump file and then need to move to desktop folder Tool dump input.

Thanks,
Lakshmi

Hi @lakshmi.mp

Try with Move File activity

image

Check Out the XAML file

RenameFile.xaml (6.0 KB)

Regards
Gokul

1 Like

@Gokul001 ,
image
Can we do this path as dynamic by using (Environment.SpecialFolder.UserProfile)

Thanks,
Lakshmi

Yes @lakshmi.mp , We can

Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)+"\Desktop\Tool dump.xlsx"

Regards
Gokul

1 Like

Hi ,
@Gokul001 , @RajKumar_DC Thank you.
@Gokul001 able to run the latest file and renaming the latest file dynamically. Thank you so much for helping.

Thanks,
Lakshmi

1 Like

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