I’m using Load Image Activity and then OCR to extract the specific text from the image and then i have to move the image file to another folder. For that I’m using the “Move File” Activity. But I’m getting the below error:
Move File: The process cannot access the file because it is being used by another process.
The error you’re encountering occurs because the image file is still being held by the Load Image or OCR activity when the Move File activity attempts to move it.
Add a Retry Scope Activity: This will allow you to repeatedly attempt the move operation until it succeeds.
The Retry Scope will attempt to move the file up to 3 times (default value), with a 1-second interval between attempts. You can adjust the NumberOfRetries and RetryInterval properties in the Properties Panel based on your success rate. If the file is still in use after all retries, you can log an error or take other actions as needed.
If the above solution doesnt work as expected then you can try using garbage collection (GC) to force the release of any resources that might still be holding onto the file.
Below is the Sample workflow Of your Scenario
Move the Load image and OCR activity to separate workflow and invoke it your current workflow. Pass the required output with Out Arguments from it. This way UiPath will do garbage collection properly without explicit GC calling.