If you found this page, then most likely you’re updating or restarting Visual Studio Code and you got this error message:
![There was an error while Deleting a directory: [path] The process cannot access the file because it is being used by another process. (os error 32) Please verify there are no Visual Studio Code processes still executing](https://wpforthewin.com/wp-content/uploads/2020/03/img_5e632921cd557.png)
There was an error while Deleting a directory: [path]
The process cannot access the file because it is being used by another process. (os error 32)
Please verify there are no Visual Studio Code processes still executing
You’ve probably hit “Retry” a dozen times. I get it—it’s frustrating when you just want to update your code editor and move on.
As an experienced WordPress developer who deals with development tools daily, I’ve run into this issue more times than I can count. The good news? There are far better solutions now than there were a few years ago.
Quick Fix: Run VS Code as Administrator
The fastest fix for this error, especially on Windows, is to run VS Code with administrator privileges. Right-click your VS Code shortcut or the Code.exe file and select “Run as administrator.”
This gives VS Code elevated permissions to handle file operations that might otherwise be blocked, including deleting directories that are in use by other processes.
The Real Culprits: What’s Actually Locking Your Files
The error message tells you to “verify there are no Visual Studio Code processes still executing,” but the reality is that other applications are often the real cause. Here’s what to check:
- Cloud Sync Tools — OneDrive, Dropbox, Google Drive, or iCloud can lock files while syncing. Pause syncing before updating VS Code.
- Antivirus Software — Windows Defender, Malwarebytes, or other security tools may scan files during the update process.
- Microsoft Teams & Slack — These apps keep files open in the background more than you’d think.
- Terminals Still in the Directory — If you have an integrated terminal cd’d into the folder you’re trying to delete, that will block it.
- Build Processes — Running npm, yarn, or other build tools that are actively modifying files in the directory.
Pretty cool, huh? Often it’s something completely unrelated to VS Code causing the problem.
How to Fix It: Step by Step
1. Close Everything First
Before trying anything else:
- Close ALL VS Code windows completely
- Check that no integrated terminals are open
- Close any command prompts that might be in that directory
2. Check for Running Processes
On Windows, open Task Manager and look for:
- Code.exe or VSCode.exe
- OneDrive, Dropbox, or other sync clients
- Any terminal sessions
End any processes you find, then try “Retry” in the error dialog.
3. Use Terminal Commands (More Reliable)
If the GUI keeps failing, the terminal is your friend. Close VS Code entirely, then open your system terminal:
// Windows (Command Prompt or PowerShell)
rmdir /s /q "C:pathtodirectory"
// Linux
rm -rf /path/to/directory
// macOS
rm -rf /path/to/directoryMake absolutely sure you’re not currently IN the directory you’re trying to delete.
4. Disable Extensions (Yes, Really)
VS Code extensions can hold file locks. Try running VS Code with all extensions disabled:
code --disable-extensionsIf this works, re-enable extensions one by one to find the culprit.
5. Switch to the System Installer
If you use the “User Installer” version of VS Code, you may run into this error more often. The User Installer has limitations during updates. Consider uninstalling and switching to the System Installer version instead.
The System Installer requires admin rights but handles updates more reliably.
What About Kodi?
You might have read older posts mentioning Kodi as a culprit. While Kodi can cause this issue, it’s far less common now. The more likely offenders are cloud sync tools and modern collaboration apps like Teams or Slack.
Final Thoughts
The “error while deleting a directory” error in VS Code is annoying but solvable. The key is identifying what’s actually holding the lock—and it’s rarely VS Code itself.
Start with running as administrator, then check your background apps. In most cases, one of those two fixes will do the trick.
If you run into this error and find a solution that isn’t listed here, drop a comment below. It might help the next developer who stumbles onto this page!
I hope this helps you get back to coding!
Related Posts:
Blogger, expert WordPress developer, and developer of the awesome bbPress Voting plugin which is a must-have plugin for any bbPress forum.
Download bbPress Voting for free on the WordPress Plugin Directory.



I was having the same issue. I closed Microsoft Teams and VS Code update completed successfully.
I closed Malwarebytes Anti-Malware and VS Code update completed successfully.
vm ware will influence the vscode update
Avast Free Antivirus blocks VS Code Update. Take into account every possible antivirus
I closed IOBit Uninstall monitor .. the problem solved