Some files and folders are just too stubborn to delete easily. Try these tips.
By Zubair Alexander
Q: Why am I unable to delete a file or a folder in Windows Explorer? What are some of the common scenarios and solutions?
A: As far as NTFS is concerned, internally it treats folders as a special type of file. Therefore, we will use the term "file" to refer to both files and folders here.
There are many possible reasons why you may not be able to delete a file. For example, if you don't have proper permissions, you will get an "access denied" error. To delete files, you will need to log on as an Administrator, take ownership of the files and give yourself permissions to delete the files before deleting them.
Under certain situations, you may not be able to delete the files in Windows Explorer, even if you take the ownership. For example, if the access control entries in an Access Control List (ACL) has a certain sequence, it may prevent you from deleting the files. In such cases, use CACLS.EXE at the command prompt to overwrite the existing ACLs.
Sometimes the problem may be too simple. For example, you cannot delete a file that's open. Simply close the file and then delete it.
If the file is corrupted, you may not be able to delete it. Use CHKDSK with /F switch to fix the problems and then try to delete the file.
Sometimes, the file path is too long to get to it. Typically, the path length must not exceed 255 characters. In these situations, use the 8.3 filename to access and delete the file. In some cases you may have to rename some of the folders to shorten the path.
If a filename contains an invalid name (like a trailing period or space) use the \\?\ syntax. For example, to delete a file called "myfile.txt " which has a space at the end, use the syntax:
del \\?\c:\myfile.txt
For more details, check out the Knowledge Base article Q320081, "You cannot delete a file or a folder on an NTFS file system volume," on Microsoft's Web site at http://support.microsoft.com/kb/320081 .
Comment: http://mcpmag.com/columns/article.asp?editorialsid=1738#post
Zubair Alexander, MCSE, MCT, MCSA, and Microsoft MVP is the owner of SeattlePro Enterprises http://www.seattlepro.com/ , an IT training and consulting business. His experience covers a wide spectrum: trainer, consultant, systems administrator, security architect, network engineer, author, technical editor, college instructor and public speaker. Zubair holds more than 18 technical certifications and Bachelor of Science degrees in Aeronautics & Astronautics Engineering Mathematics and Computer Information Systems. His Web site, http://www.techgalaxy.net , is dedicated to technical resources for IT professionals. alexander@techgalaxy.net
