How to rename recently downloaded file and move that file text file

How to rename text file form downloaded and move that file in specific share path

Thanks

Hi @suraj_gaikwad

You can either enable the “Ask where to save each file before downloading” in chrome settings then change the name and location during automation
or
After downloaded the file change the name by “rename file” activity by providing the downloaded file path.

You can move the file to specific path using move file activity.

Regards,

1 Like

HI @suraj_gaikwad

Just use Move activity to move the file to the desired folder location and add the new name in the TO

image

Regards
Gokul

1 Like

Hi @suraj_gaikwad

If you don’t want to change the chrome settings to ask everytime where to download,
you can use Wait for Download activity. and get the filepath from there.
Later use a Move File activity, and you can rename it then and there.

Thanks :smiley:

Hi @suraj_gaikwad
Try like this

In this image I want to move that file only whenever bot will run move only recently file download

@Gokul001 @adiijaiin @lrtetala

@suraj_gaikwad
Try this

Directory.GetFiles(downloadDir, filename+“*.pdf”).OrderByDescending(Function(f) new FileInfo(f).CreationTime )(0)

Hi @suraj_gaikwad

This expression will get the Latest file in the download folder

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

Regards
Gokul

You can use for each file for iterating and find the latest downloaded file.
image

Regards,

1 Like

Hey @suraj_gaikwad ,

Please use this to get the Latest downloaded Text file

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

Now you can Move that particular file using “Move File” Activity
and Rename it using “Rename File” Activity

Regards,

1 Like

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