Delete Activity is showing error while deleting the files from the folder

{
“message”: “Delete: The process cannot access the file ‘C:\Users\nanda\OnBoarding\Documents\ SmartLinx.docx’ because it is being used by another process.”,
“level”: “Error”,
“logType”: “Default”,
“timeStamp”: “16:45:45”,
“processVersion”: “1.0.7083.23993”,
“jobId”: “746dc22c-5293-4dd1-8350-93f11dc2644c”,
“robotName”: “Nanda”,
“machineId”: 143,
“fileName”: “Process”,
“logF_BusinessProcessName”: “Framework”
}

1 Like

Check if process “winword.exe” or similar related to Microsoft Word is running at the execution of Delete Activity.

Can you please elaborate it

A way to do could be:

  1. Get List of Process (with Get processes activity)
  2. ProcessList.Where(Function(x) x.ProcessName.Contains(“word”)) to know if Word is a running process
  3. If yes, Kill it (or take other action)
  4. Delete Files as usual.
  5. End :slight_smile:

Buddy
Welcome back to uipath community buddy
its very simple and you know you were almost done…
The thing we need to do now is to stop by the docx file that is MSWord application running that file should be stopped before deleting that file… So generally to stop a application running, we can use KILL PROCESS activity with the application name as input to the PROCESS NAME property in kill process activity…
To know the exact process name, exact application name that runs that SmartLinx.docx file, go to task manager, and in process tab see the name of the application that runs that file say for example…MSword.exe or Word.exe… like that
Then take that name alone like MSWord or Word alone and pass that as input to the process name in kill PROCESS as a string buddy like this “WORD” or “MSWORD”

Now after this kill process activity place your delete file activity buddy…it will delete the file…

Thats all buddy you are donee
Kindly try this and let know whether this works or not buddy
Cheers @gvkishore

2 Likes

did that work buddy @gvkishore

Hi ,

Nope it still says the same issue I tried to kill the process and do all the stuff you mentioned but still no luck
Any Alternatives

Thank you
Nand

Btw I was trying to delete the multiple documents using ForEach, I am killing it before deleting the file from the folder but some how it shows an error

I was able to see all the files coming in the for each but when I tried to delete it stops

Can same one explain me what would be the cause , but when I do it in loop its getting faulted but when i do it in separate I can delete the file using same logic

Appreciate your help

Thank you
Nanda

is the File or Files shared with someone at network level? example: files at \myserver\myfolder shared with you but with access to someone inside department…

Buddy if possible can i have a screenshot of your for loop where you are trying to delete the file
Cheers @gvkishore

This is on my local machine and I have admin rights to my machine

Thank you
Nanda

Here you go

use the kill process within that for each loop buddy and do this only if the documents in the for each loop are of same application or type or even we can call .exe

Cheers @gvkishore

Still the same issue
Find in the attachment for error

Thank you
Nanda

  • Could be because Antivirus Software is checking the File?
  • Is the File “Protected” Or Similar to block such operation?
  • If word is not running, What’s program that is using the file?
  • Could be because Antivirus Software is checking the File?
    there is a possibility for this one Ill check and update back to thread

  • Is the File “Protected” Or Similar to block such operation?
    This is not a protected file

  • If word is not running, What’s program that is using the file?
    No other program is using the word file I was making sure to kill or close all the files before run the process

Antivirus is also off and still the same error

Can some one help me to solve this issue

Thank you
Nanda

  • Are you using programs like OneDrive, GoogleSync, DropBox or similar to sync local files with cloud?
  • Make Sure if there is any “backupfile” of your file file (When open Office files, it creates a hidden file similar to “~filename.docx” that sometimes keeps alive after program ends)
  • Open Cmd, Try to Kill “explorer.exe” process and from Cmd, delete file
  • Try make delete operation with Powershell, If works, make your robot able to call Powershell Script to do this task.

Thank you for your quick turn back ,

The interesting thing is when eve the bot is in loop it is getting faulted but when I test it separately it is working fine

I am not using any cloud related apps to sync my document

Can you help me with power-shell script to kill the background process

Thank you
Nanda

Hello, I have same proble, but mine is working on studio or Dev environment, and error when live environment … any idea ?

Thanks !