How to Delete Undeletable Files and Folders in Windows

Windows 7
Windows 7

Have you ever tried but failed to delete files or folders on Windows? Often malicious programs create such undeletable items, which cause an error message to pop-up when you try to delete them. In this post, we shall learn how to delete undeletable files and folders without using any extra software. Please read the warning at the bottom before proceeding.

  1. Through the Search Box or Run Dialog open “CMD”, which is the MSDOS command prompt.
  2. You should ordinarily land up in the User directory when you open cmd, but anyway, type “CD..” and press Enter or Return until you reach the root directory (the drive in which Windows has been installed like C or D). CD stands for Change Directory.
  3. Open the folder which contains the files and folders you want to delete but cannot delete normally. In the address bar at the top of the Explorer window, you can get the exact address by clicking on the path. Copy it using CTRL+C.
  4. Now, type “CD” followed by a space and then paste the previously copied address. Press Enter or Return to go to that directory.
  5. Now type “dir /A:SH” and press Enter. You can now see a list of all files and folders in the directory including system files and hidden files. If you want to avoid accidentally deleting system files, just type “dir” and press Enter.
  6. Type “del *.* /A:SH /F” to delete all the files (not folders) in the directory. If you want to delete a single file, just type “del” followed by a space, then the File Name exactly as listed by the dir command and the “/F” tag. Press Enter or Return to execute the delete command. Ordinarily Windows will only allow you to delete files which are not specially flagged. Using the /F this command will delete the files whether or not they are specially flagged. Malicious files are usually tagged to prevent you from deleting them.
  7. In order to delete undeletable folders instead of files, you need to use the “rmdir” command. Go to the directory or folder which contains the folder you want to delete and use “dir” to list the folders inside it. Then type “rmdir” followed by a space and then the name of the folder you want to delete. It is necessary to type the exact folder name as listed by the “dir” command.


The method I’ve described above for removing or deleting files which can’t be deleted using the Right-Click or Shortcut menu or the keyboard shortcut (delete button) should be used very carefully. The /F flag deletes all files without heeding the current status of any file. So, if you accidentally delete a necessary system file you might end up with a damaged Windows installation. Therefore, you should only delete files you are absolutely sure about.

If you can’t remove a file or folder using this method, please let us know.

Share Feedback We Want to Hear From You