Access Denied on File Delete or Cannot delete file

If you receive an “access denied” message on your PC, whether in Windows or Linux, which occurs when trying to delete or modify a file, it can usually be narrowed down to a few reasons:

– The file is marked as readonly
– The file is located on a CD, disk, drive, removable device or any other storage type which is either marked as readonly for the entire volume or your files are contained within a readonly partition in this volume (which can easily occur in linux if you manually mount a drive improperly)
– You do not have access to delete the file or are not an owner of the file
– The file is currently open or in use

If you are deleting the file using code in your .Net application, be sure to remove the “read only” attribute which won’t prevent a user from deleting it, but will definitely halt your application. (code reference).

If you are absolutely sure you should be able to delete the file, or are trying to remove a file which be malicious or difficult to delete, there are tools available such as file assassin which can be used to override the normal OS safeguards (if you have the right know how and permissions) and delete the file anyway.

References
Imran Akram (WordPress BLOG)http://imak47.wordpress.com/2009/01/15/how-to-remove-readonly-attribute-from-a-file/
MalwareBytes “FileAssassin”, http://www.malwarebytes.org/fileassassin.php

About Ronnie Diaz

Ronnie Diaz is a software engineer and tech consultant. Ronnie started his career in front-end and back-end development for companies in ecommerce, service industries and remote education. This work transitioned from traditional desktop client-server applications through early cloud development. Software included human resource management and service technician workflows, online retail e-commerce and electronic ordering and fulfillment, IVR customer relational systems, and video streaming remote learning SCORM web applications. Hands on server experience and software performance optimization led to creation of a startup business focused on collocated data center services and continued experience with video streaming hardware and software. This led to a career in Amazon Prime Video where Ronnie is currently employed, building software and systems which stream live sports and events for millions of viewers around the world.

Posted on March 29, 2011, in Programming & Development and tagged , , , , , , , , , . Bookmark the permalink. 1 Comment.

  1. I have used Long Path Tool in this situation and it helped me easily and quickly.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: