Can't Delete Folder because file inside is used by another process

Hi, I have a problem with deleting Temp Folder.

The cause is because the file inside which is png is used to be resized (I’m using Balareva Resize Image activity and also tried another approach using Invoke Method).

There’s someone with similiar problem, I tried their solution but no go.

also this, and not working

any other solutions?

Hi @ibnu.alem

The error is because image is opened in background, can you try to use Kill Process activity before Delete Folder activity
In Kill Process activity mention Microsoft.Photos

Cheers!!


like this? still not working

@ibnu.alem

Can you try to give Photos or png in Kill Process

also not working. The folder also can’t be deleted manually until UiPath.Executor stop the process

Hi @ibnu.alem

Are you using the png files in the further below workflow process. Since the error indiactes that 19-Januari-2024.png picture is being used and is opened in the backgroung. That’s the reason it’s not deleting the folder. Try the close that png process and try giving Delete Folder. This should work for you.

Regards

the file is not actually opened. It is used by resize Image activity before attempt to delete the folder that contains the file. The one and only process that affect the file is UiPath.executor itself and of course I can’t kill it

@ibnu.alem

Try to end the process of Resize Image activity and then Delete the folder.

Regards

Can you please elaborate how to do so?

The Delete Folder Activity is right after Image Resize Activity
image

@ibnu.alem

Instead of Resize Image activity could you download the xaml file of Resizing images in the below thread and after that Delete Folder. I have attached the thread too.

Regards

Ahh sorry nevermind. I found the cause myself.
it is because the Variable bitmap that I made for the purpose of resizing the image. Since The Bitmap Var is assigned like this:
bitmapImage = New Bitmap(“Path of the Image”)

so the file itself is bound to the variable hence I need to dispose the value of the var using Invoke Method Dispose first then proceed to delete the file since the file no longer bound to the variable.

thanks!

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