File being used by another process error with moving and deleting files

I am working on a process that downloads and separates PDF files from a website. Once the PDF files are downloaded into a main folder, they are read with a Read PDF Text activity and either separated into new folders or left alone (indicators in the text tell the bot to separate or not). Once they are or are not separated, I want to do 2 things:

  1. Move the files that were not processed into a separate folder
  2. Delete all files from the main folder as we only need the separated files from the new folders

I am receiving an error which reads “The process cannot access the file because it is being used by another process.” when I get to the file moving step (activities below). However, there is no PDF open in adobe or any other process I can find that would be using these files. Can anyone help me troubleshoot this issue?

1 Like

Are you sure your destination path is ok? maybe is the destination path that is in use…

How do I check for this? The file path is correct when I have it write to the log and none of the files are open in the foreground.

Folder_NotProcessed+PDF_FileName is sure to be ok? and your process never opened that source file either?

Yes, I have been checking the To: file path and it is correct. For context it is a combination of the source file name and the folder path I wish to move it to.

The source file itself is accessed before the file moving section via PDF Activities such as Read PDF Text and Extract PDF Page Range. The bot does not open the file so that it is visible, all the actions are in the background. I added a Kill Process activity to close Adobe in case it is open in the background and that never worked either.

but adobe wont be used by a read pdf activity, so the file can really be in use by uipath, put at least a little delay to make sure is not the case…

I added a delay of 5 seconds and it works for the file migration after a few test runs.

However, I am receiving the same error for the activities to delete the downloaded files that remain in the source folder. I tested this with a delay of 5 and 10 seconds to no success. It is finding the correct folder as indicated by the error message but is not able to delete it.


as soon as your processes ends with the error, you can delete them manually? make sure you are not deleting inside some opened read pdf scope or something…

Before For each loop use a KILL PROCESS activity
and mention the input as “AcroRD32” to the property ProcessName property
Cheers @AndrewRoda

Yes, I am able to delete them manually. This was an issue before so I added a kill process for “iexplore” after the files are downloaded. With this addition, the moving files sequence usually works when I run the bot through the entire process, but fails at the Delete sequence. If I run the bot from the part of the process that processes the PDFs without accessing the internet, I receive an error on the moving sequence again. I have also discovered if I only run the Delete sequence, it works.

The Moving file sequence is in the same sequence with the loop that reads the PDFs, but outside of the loop. Could this be causing the inconsistent results?

The Delete sequence is a separate sequence outside of the file download/processing sequences.

This was meant to reply to @bcorrea

so you are saying those files are coming from the internet to your disk? then the one holding them are the internet explorer and the windows… did you try with another browser?

That is correct. Due to production environment requirements and the content being accessed by the bot it must use Internet Explorer.

I am not sure if the browser is causing the error because running the PDF processing/moving/deleting sequences without the file download receives the same errors for Moving and Deleting.

oh ok then, use a retry scope with 5 seconds between tries and see if it end up releasing it self or not…

Still receiving the same error

@AndrewRoda Is the error popping in the middle of the loop or from the first iteration itself.

you should, but you use that to retry automatically, set it for several times to test if it will eventually work or if you will really have to try killing processes…

First iteration

I set it to try for 3 times with 5 seconds and have received the same error. I really am not sure what processes outside of Acrobat or the UiPath Executor would be using the file and preventing it from being moved or deleted. I am sometimes creating the folder to move the files to if it doesn’t exist already. Could this be using another process preventing movement/deletion?

you can try solutions like this to see the culprit: