Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot delete files, "access is denied"

Status
Not open for further replies.

weberm

Programmer
Dec 23, 2002
240
US
I recently discovered some files on my secondary hard drive which had become corrupted and needed to be deleted, however, when I try to delete them, I get a "Cannot delete file name: access is denied". I've poked around a bit online but none of the suggestions there are working. This is what I've tried thus far:[ul]
[li]Open the Task Manager to kill processes (none found).[/li]
[li]Delete the file in a DOS window.[/li]
[li]Reboot in 'safe mode' and delete the files.[/li]
[li]Delete the file while holding the SHIFT key.[/li]
[li]Installed Unlock but it didn't find anything wrong.[/li]
[/ul]
Does anyone have any more suggestions? Could this be caused by spyware/trojans?
 
You could try booting to DOS (press and hold F8 at power on till the menu appears). Select Dos, at the C:\ prompt change to your secondary drive and do a directory search and listing. If it finds them, try deleting at this point.
You haven't specified what the files are or what you use the drive for. If you have important files that can be backed up to CD or copied to you primary drive, you could then reformat the drive.
ASG
 
Go to a command prompt (start --> run --> cmd)

CD to the folder with the file

enter:
attrib -a -h -r -s filename.ext

del filename.ext



Just my 2¢

"In order to start solving a problem, one must first identify its owner." --Me
--Greg
 
thread779-1182368 said:
I find 'Unlocker' to be a quick and easy solution to deleting locked files and folders.
Unlocker didn't work either. It returned an "access is denied" message and and didn't delete the files on bootup.
thread779-1182368 said:
You may want to download Killbox and delete it with this program:

Oddly enough, this program told me "This file does not seem to exist".

ASG0856 said:
You could try booting to DOS (press and hold F8 at power on till the menu appears). Select Dos, at the C:\ prompt change to your secondary drive and do a directory search and listing. If it finds them, try deleting at this point.
I tried doing that last night and got an "Access denied" message for [tt]attrib -r[/tt], [tt]erase[/tt], and [tt]del[/tt]. There's about half a dozen documents and pictures on the hard drive I use for data storage which have this problem. I discovered them while burning a backup CD and the files could not be opened. When I tried to replace the files from an older backup, but I couldn't overwrite them.


I ran [tt]CHKDSK[/tt] on the drive from a DOS session and it found some lost strings so I ran it with the "/F" flag and I think it ran OK, but I am still unable to touch these files. [ponder]
 
Are the files in a directory structure with a long name? Sometimes this can happen if the directory path is too long. I think the limit is around 255 characters but it is often possible to exceed this. If this is the case, try shortening the directory path and try deleting the files again.

--------------------------------------
"Insert funny comment in here!"
--------------------------------------
 
TheLad said:
Are the files in a directory structure with a long name? Sometimes this can happen if the directory path is too long. I think the limit is around 255 characters but it is often possible to exceed this. If this is the case, try shortening the directory path and try deleting the files again.
I don't think the names are too long. There's other files in the same directory which are fine. At this point I can only guess that somethng "hiccuped" and corrupted their entry in the FAT...
 
What are the file names which you can't delete? Can you supply the Property details as to size etc. Is the file system NTFS? Can you supply the full path details. Are there any Deny Permissions set on these files?

Have you run ChkDsk /r via the right-click your Drive icon/ Properties/ Tools/ Error Checking. Select both boxes.
 
1. Right click the folder/file in question.
2. Make sure Read-only is unchecked.
3. Go to the Permissions tab (which is only there if your file system is NTFS) and make sure your WinXP username is listed (add it if necessary)
4. Give your username full control
5. Hit OK

You should be able to delete the folder/files afterwards. I apologize if this was already suggested above. I just did a quick scan and didn't see that it was tried.

~cdogg
"Insanity: doing the same thing over and over again and expecting different results." - Albert Einstein
[tab][navy]For general rules and guidelines to get better answers, click here:[/navy] faq219-2884
 
Hello,

i am posting here as my problem is quiet same.

Here is problem : I have Recently 2 OS running on my laptop 1 XP Pro and other Vista Beta for some reason my boot menu disparead so i decided to delete all data regarding Vista as i dont use it and it taking alot of space on HD, the vista was installed on D drive, i was able to delete all data concerning User etc.. but I am unable to delete Windows folder and some folders in programme files folder. When ever i try to delete it i have an error message : Access is denied ..... I have used all method explain : Dr Delete , MoveonBoot , Unlocker etc.. also tried to boot in XP Command promt and even there i have same message. Cant Change attributes also i have an error message. I realy need the space it is taking 9 GB of my space. I cant format the drive as i have 40 GB of other data on it.

Thanks alot for all your help
 
netuserfr,

From XP try taking ownership of the Vista files and folders, any files that prove awkward and deny access try checking to see if the deny permission for the Everyone Group is checked (a common enough occurrence in Vista).

HOW TO: Take Ownership of a File or Folder in Windows XP (Q308421)

Error Message: "Access Is Denied" When You Try to Open NTFS File System Folders

There is this you can look at too.

How To Reset Security Settings Back to the Defaults
 
Sorry for the lateness of this response.
linney said:
What are the file names which you can't delete? Can you supply the Property details as to size etc. Is the file system NTFS? Can you supply the full path details. Are there any Deny Permissions set on these files?
Here's a couple file names:

D:\My Documents\My Pictures\allen_7.jpg
D:\My Documents\My eBooks\D & D\BONEWIZ.DOC

I checked the properties and they have the dates asscoiated with it and none of the boxes (Read-Only, Hidden,Archive) are checked. I did notice, however, that the Summary tab is greyed out with a "Summary properties unavailable for selected source" message. The disks on my PC are in FAT32 format. Oh yeah, I noticed when making CD and DVD backups a couple days ago that a couple more files are now doing this! [surprise]
linney said:
Have you run ChkDsk /r via the right-click your Drive icon/ Properties/ Tools/ Error Checking. Select both boxes.
I did this last night but the files were still doing the same thing.
 
Can you copy them? Either GUI or command line?
Once copied, if they did, can you remove the copy?
And if they copied, can you copy the copy back onto the original?
This shouldn't be a problem with the FAT, but rather a problem with the directory. Something like corruption in the attributes byte.
I would be curious if you could remove the folder that contains the subject files.
Before trying it move anything of value elsewhere.




Ed Fair
Give the wrong symptoms, get the wrong solutions.
 
The hard drive manufacturer will have free diagnostic software that will thoroughly check out the condition of the hard drive.

Have you thought about converting your drive to the NTFS (not reversible) then you can "play" with access permissions?

Converting FAT32 to NTFS in Windows

307881 - HOW TO: Convert a FAT16 or FAT32 Volume to NTFS in Windows XP
 
edfair said:
Can you copy them? Either GUI or command line?
Once copied, if they did, can you remove the copy?
And if they copied, can you copy the copy back onto the original?
This shouldn't be a problem with the FAT, but rather a problem with the directory. Something like corruption in the attributes byte.
I would be curious if you could remove the folder that contains the subject files.
Before trying it move anything of value elsewhere.
I could not copy the files from either GUI or command line.
I tried deleting all the other files in the directory (I had backed them up to a CD earlier this week, excluding those files, which threw "cannot copy to CD" error messages) and then deleting the directory without any luck. I tried it again by rebooting in DOS mode (as administrator) and it still complained about the directory not being empty (Using *.* within the directory fared no better). Oh yeah, I thought that perhaps "D & D" in the path might be causing the problem for one the files and renamed it to "D", but that didn't help either.

linney said:
Have you thought about converting your drive to the NTFS (not reversible) then you can "play" with access permissions?
I am seriously contemplating that but want to do some more research.

firewolfrl said:
By chance is your OS XP Home?
Yes. I upgraded my PC from Win 98 to XP Home.

 
Ahhhhhh!

that helps ALOT


XP home has some security tabs disabled to take ownership

First and formost....get rid of the the FAT32....NTFS is way more stable...and you can take security of the files much easier. As I saw above linney has posted the link for the conversion....

The Security tab link does not work for FAT32/FAT drives but works fine with NTFS drives

these links give your the Security tab fix


this link gives you the software to manage your account profiles and create groups in XP home

the side benefit is you can take ownership of another profile and assign your primary profile as Administrator only

its almost as good as owning XP pro after those programs are installed

now for your original problem this piece of software is hands down the best piece of software I have ever found to remove nasty unremovable files...I have found it to work even better then Unlocker
Delete FXP Files

though the free edition is gone it is well worth the price
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top