File being used by another process (no process to kill)


I have an automation that processes scanned image files and reads the content using OCR. Any scans that are successfully read are to be deleted so the automation stores their file paths.

At the end of the automation the files are deleted one by one using a For Each activity however the deletion of the last file in the list always fails due to it being used by another process.

I have tried to put in some artificial delays just before the delete portion of the automation but to no avail.

I have also tried moving the files instead of deleteing them but the lock is still blocking the action.

I have also tried adding invoke methods to force garbage collect and WaitForPendingFinalizers after the Load Image and OCR activites and before the Move File activity.

I have looked through all related posts and many are related to cases whereby the file in question is actually opened during the automation however I have run the job with Task Manager open and I do not see any additional processes open/close whilst it runs as the automation does not actually need to open the files it all runs in the background.

Also finally if I attempt to manually delete the file immediately after the automation has failed to do so I get no error at all which suggests there is no lock…

Has anoyone come across a similar issue?


This has been solved by adding the following after the OCR scanning process AND before the move file process.



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