Broken File Change Trigger

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.
image
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:
image

I can think of 2 possible causes for this error.

  1. 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
  2. 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

1 Like

Hi @Allison_Matthews, is there any other way to monitor the download progress of the excel instead of using file change trigger?

Not that I’m aware of, but I’m open to other methods if that’s what you’re asking

Nah, just trying to understand your process better. What I can think of now is to add a IF in your Event Handler to check whether the File Name contains .xlsx. If it is then you proceed with moving your file. Hope that helps.

Cheers,
Q

Have the same Problem.

I have tried “Delay Activity”. It Works, copies the original file and not temporary.

can you please share a image of it…