Process cannot access file error


I am mergin 2 images and saving in one folder and then i need to delete folder which contains those 2 images which i merged as 1.
I am using delete activity and sending path of perticukar folder to delete
but uipath thowing me error.
please check below ss.
i tried using powershell command also but not worked.
if i run as test activity i is working but while running script throwing above error
please help.

Add 5 seconds delay before delete activity
Merging of image file will take at least 5 seconds if not more. In this 5 seconds file will be in use hence you getting this error.

checked with delay but still same error

how much of delay you tried…?

8 sec delay

can you upload for xaml file… I can see you are using powershell to merge (if I am not wrong)

workflow is big and re framework and not able to share with security reason.
any other way like kill process?
and if kill process then what i need to pass in properties

it depends… what you are using for merging/combing the images.

invoke code

copy paste your invoke code here


chekc this ss
not invoke code invoke method*

can you copy paste this specific sequence in test file and upload. I will test with junk images
It would become easy for us to troubleshoot.
For now I guess image is not being released after reading hence causing this issue.

MergeImage (2).xaml (12.3 KB)

1 Like

Put this before the Delete activity:


The second one is: WaitForPendingFinalizers

Note that I’ve had this same problem when trying to send SMTP Email with an attached file then trying to move/delete the file. There appears to be bugs in UiPath where it doesn’t let go of the files like it should.

Try @postwick solution
Your test file worked perfectly fine for me. I added Delete activity at the end; after disposing Final Image.

pleae send me image again .
unable to view image whcih u sent

able to view now after refresh.
i checked in my workflow as you mentioned but not worked .
any parameters we need to pass?

Thanks worked .

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