Windows Advisor

Spring Cleaning On Your Hard Drives

Some files and folders are just too stubborn to delete easily. Try these tips.

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.

Tech Help—Just An
E-Mail Away

Got a Windows, Exchange or virtualization question or need troubleshooting help? Or maybe you want a better explanation than provided in the manuals? Describe your dilemma in an e-mail to the MCPmag.com editors at [email protected]; the best questions get answered in this column and garner the questioner with a nifty Redmond T-shirt.

When you send your questions, please include your full first and last name, location, certifications (if any) with your message. (If you prefer to remain anonymous, specify this in your message, but submit the requested information for verification purposes.)

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.

About the Author

Zubair Alexander, MCSE, MCT, MCSA and Microsoft MVP is the founder of SeattlePro Enterprises, an IT training and consulting business. His experience covers a wide range of spectrum: trainer, consultant, systems administrator, security architect, network engineer, author, technical editor, college instructor and public speaker. Zubair holds more than 25 technical certifications and Bachelor of Science degrees in Aeronautics & Astronautics Engineering, Mathematics and Computer Information Systems. His Web site, www.techgalaxy.net, is dedicated to technical resources for IT professionals. Zubair may be reached at [email protected].

comments powered by Disqus
Most   Popular

Upcoming Training Events

0 AM
TechMentor @ Microsoft HQ
August 11-15, 2025