Delete Image file

Hi,

I have some list of Image files in a folder. I need to extract values from it using OCR and after extraction, I need to delete that image. I’m doing this in for loop. And while trying to delete the image file, I’m getting the error, ‘The process cannot access the file because its being used by another process’. How can I delete this file. Can anybody help me on this please?

Thanks in advance!

Kind Regards,
Renju

Hi @renjutom,
This usually happens when you have the image open by any other application. You can check if there is any image viewer opened in the background, the second possibility is the reading of the image by ORC, try putting a 5sec delay after the OCR activity. This should help i presume.

Hi @vishal.kp,

Thanks for your quick response.

I’m using OCR activity for reading data from images. I’m placing the OCR engine and delete activity in a for loop. So, even after placing the delay activity, it is showing the same error.

Kind Regards,
Renju

Can you share a screenshot which shows how you have implemented the delay @renjutom

Hi @vishal,

Please find below
image

So the delay is kept between the OCR activity and delete activity right?

Hi @vishal.kp, Yes. I kept delay activity in between OCR and Delete activity. Also, there are some other activities in between OCR activity and delete activity for extracting specific values from the text extracted.

Is there any other way to resolve this issue?

Kind Regards,
Renju

Can’t you delete the files after the for loop? In the ‘OCR for loop’, add the path to all images to a list and then delete them after the ‘OCR for loop’.

1 Like