SEARCH

How-To Geek

How To Delete, Move, or Rename Locked Files in Windows

image

Windows won’t allow you to modify files that open programs have locked. if you try to delete a file and see a message that it’s open in a program, you’ll have to unlock the file (or close the program).

In some cases, it may not be clear which program has locked a file – or a background process may have locked a file and not terminated correctly. You must unlock the stubborn file or folder to modify it.

Note: Unlocking certain files and deleting them may cause problems with open programs. Don’t unlock and delete files that should remain locked, including Windows system files.

Unlocker

Unlocker is a useful utility for unlocking files. With Unlocker installed, you can right-click a stubborn file or folder and select Unlocker. (Note that Unlocker tries to install the Babylon toolbar during the installation process – you’ll want to uncheck this.)

image

You’ll see a list of processes that have locked the file or folder. You can kill the processes or quickly unlock the file while leaving the processes running. Note that this may cause problems if a process expects exclusive access to a file.

image

Once the file is unlocked, you can delete, move, or rename it normally.

Process Explorer

You can also unlock a file in the excellent Process Explorer task manager. First, launch Process Explorer as Administrator – you can do this from within Process Explorer by clicking File and selecting Show Details for All Processes.

image

Next, click the Find menu and select Find Handle or DLL. (Or press Ctrl+F.)

image

Search for the name of the locked file or folder.

image

Select the locked file or folder and you’ll see the handle in the details box at the bottom of the Process Explorer window.

image

Right-click the handle and select Close Handle. If multiple processes are listed in the search window, you’ll have to remove to repeat this process to close the handle for each process.

image

You can now delete or modify the file normally.

Restart Your Computer

Generally, a file won’t be locked after you restart your computer – unless the program that locked it is a startup program that locks the file as soon as you log in. If you have a stubborn file or folder and don’t want to use any of the tricks here, you can just restart your computer. You should be able to delete, move, or rename the file as soon as Windows comes back up.

If the file is being locked by a startup program, you can boot to safe mode to delete it instead. Press the F8 key during the startup process and select Safe Mode to boot into safe mode. If you’re using Windows 8, you’ll have to use a different process to enter safe mode. Delete (or move) the file in safe mode and restart your computer.


There are a variety of other ways to delete locked files. For example, you could use a program to schedule a file deletion when you next restart your computer – the file will be automatically deleted when you reboot.

Chris Hoffman is a technology writer and all-around computer geek. He's as at home using the Linux terminal as he is digging into the Windows registry. Connect with him on Google+.

  • Published 11/13/12

Comments (24)

  1. andyr354

    Just had to do this yesterday. You seem to read our minds :-/

  2. John

    Unlocker is one of the first things I add to a computer – along with CCleaner.
    It’s great to see you giving it more attention.

  3. Michael

    Rather than installing Unlocker and dealing with the stealth installs of other software, just download the portable version. It contains both the 32/64bit exe’s and works just as good.Only thing you lose is the context menu entry, but that no real loss.

    ~Michael

  4. Kyle

    Got denied trying to delete a file with all these ways. Have a file thats been on my desktop for months that’s a .msg file. I just leve it hidden behind a windows 7 gadget.

  5. trebor

    How can the same be accomplished via command-prompt?

  6. harv

    iobit do a portable unlocker too at iobit dot com/iobit-unlocker.html

  7. Ruja

    Or just run an Ubuntu Live CD or USB and delete the file from there.

  8. Wayne Riker

    I use Unlocker. Very helpful when a photo app doesn’t let go of a file when it’s done with it.

  9. David

    Unlocker is very useful and works in relatively straightforward cases, but where files are on external USB disks, especially partitioned disks, you may find several system files locking them which cannot be dealt with.

    Shutdown is then still the safest way out.

    On the site there’s an interesting comparative table listing its capabilities vs many, but not all, of the numerous programs that also attempt this.

  10. williambaugh

    has anyone tried just starting a new instance of explorer and deleting that way?? works for me.

  11. thegeekkid

    Generally if a file is locked, it is locked for a reason and you do not want to unlock it. (Unless you have a virus.)

  12. whovein

    Have used this when Windows XP was the current OS to have and it works like a charm. 10/10.

  13. Andrew Kaylor

    LockHunter is also a formidable competitor.
    http://lockhunter.com

  14. Mahdi

    I can’t delete or move to other drive a folder with some files that located in drive E:\.
    The above process did not work and that folder contains 2 html files that I save as from a web page , exe files did not exist.
    when I delete that folder a message come that: Could not find this item This is no longer located in E:\. Verify the item’s located and try again.
    How shoud I do?

  15. MeltingSun

    I asume you’re using windows 7 (correct me if i’m wrong). Your E drive is a usb or a hard disk?
    Try and open this folder of yours with a file manager (for example total commander) to see if any
    other files are hiden in there. Backup and then delete.

  16. Riddle

    Unlocker is great , I used to consider it mandatory ,until I installed linux .
    BTW :Babylon toolbar is the worst piece of malware I’ve ever installed !

  17. Lighthouse

    On the forums we do not recommend iobit software at all. If you have it, get rid of it.

  18. spike

    Unlocker is the way!

  19. lesle

    For a delete, drag the file to the desktop, then try to delete it. This works for me about 50% of the time.

  20. john3347

    Do any of these procedures delete Windows 7 automatically installed folders? “My Documents” is one that comes to mind. I do not use My Documents, I create an “All Documents” folder in a slightly different location so it appears at a conspicuous location in the Explorer file tree. I don’t want any “My Documents, My Pictures, etc.” folders because I know their mine, I put them there! When I delete several of these folders, they re-appear automatically when I reboot the computer. I want them gone Henceforth and Forevermore! If I could even just change the names from the irritating “MY Something”, that would be a livable compromise.

  21. john3347

    p.s.

    @Lighthouse. What is the problem with iobit? I have been using Advanced System Care Free (versions 3.7.x and 3.8.x) for years and am quite happy with it. I have tried v4 and v5 and refuse to use either version. I threaten to discontinue iobit because of the nag screen that appears every time I re-boot wanting me to update. Please give me a reason to uninstall and get rid of the !@#$% nag screen.

  22. Fred Stanek

    I have some files ( Adobe, Avira ) deleted but not all the files are gone. These updates for both programs brought in viruses in with the download, and made it so I cannot change the security so I can take charge of the file to delete it completely. I have tried everything I googled. The fixes are for uninfected files.

  23. ReadandShare

    I used MS Securities Essentials with my Win 7 — and had been trying (but failing) to get rid of the redundant Windows Defender. With Unlocker, I finally did! Thank you!!

  24. Soumyendu

    Thanks a lot. I had problems with the locked files and had to go through Properties -> Remove Read only and so on. This program I’ll share with my friends who have the same problem.

Enter Your Email Here to Get Access for Free:

Go check your email!