how to download randomly downloaded file(file is downloaded from a website, want to rename most recently randomly downloaded file
How to download randomly downloaded file(file is downloaded from a website, want to rename most recentlyrandomly downloaded file
Welcome to our UiPath community.
Try below expression.
LatestFile = System.IO.Directory.GetFiles("FolderPath").Select(Function(f) New FileInfo(f)).OrderByDescending(Function(b) b.LastWriteTime).ToList(0).ToString
Above expression will give you last downloaded file and then you can use Move File activity to rename the file.
got it. but i dont know how to move recent file with a new name.
As I mentioned in the previous post, you can use Move File activity and pass source and destination paths.
Source Path - LatestFile (You will get it from above expression)
Destination Path - “Destination Path”+“New Filename”
i m passing “from path” as an variable in move activity but getting error
Can you print the from path using Message Box activity before Move File activity and check whether it’s printing correct file path or not. And also May I know what error are you getting here ?
latest file will give only file name in that folder , you need to use folder path along with that file name to get complete path
in from field of activity.
for eg if you are using C:\users\Test\Uipath\downloadfolder
you need to pass the above folder path to that file name so that it will work please check on this