I have a Sequence which clicks an export button on a website in order to download an Excel file. My goal is to monitor the downloads folder, and once the file has finished downloading, proceed to move the file to a specified location.
To do this I am setting the
FilePath variable =
Directory.GetFiles(“C:\Users\jmc\Downloads”).OrderByDescending(Function(f) New FileInfo(f).LastWriteTime).First()
However, when UIPath gets to the ‘Move File’ step, it fails with the following message:
I can think of 2 possible causes for this error.
- When the file begins to download, the Windows file system is creating a temporary file called 4c23xyx,.tmp when the download is initiated. Thereby triggering the File Change Trigger - but then the .tmp file gets overwritten by the downloaded file
- UIPath is creating this file when it gets to the Monitor Events handler and my Assign activity is incorrectly calculating this .tmp file to be the file with the most recent LastWrite property.
How should I fix this?
Note: when the download button is clicked, the downloaded Excel file is given a dynamic name such as Extract-01132019-x38fjArfj.xlsx