Link to home
Start Free TrialLog in
Avatar of djkaraok
djkaraokFlag for United States of America

asked on

Cannot Delete Files

I have an external USB HD attached to my laptop. At one time I backed up files to the drive via Windows backup. Now I want to clear the files off the drive to add others and I cannot remove the files. A popup window appears when I try to delete one of the files: "Destination Folder Access Denied" You need to confirm this operation - I select continue and it takes a while and eventually comes back with "Destination Folder Access Denied" - You need permission to perform this action. I have tried in safe mode and I cannot delete them that way. I have even gone to a Dos prompt and cannot delete them.
Avatar of manferg
manferg
Flag of United States of America image

If the backup is scheduled, you might have to cancel the job first.
Avatar of bfr-dwn
bfr-dwn

The files could be protected.. go to command prompt and to the directory where the backups are and type:

attrib -s -h -r /S /D

then go to the directory before the backup directory, for example if the backup is in
d:\backup

then go to d:\

and type
attrib -s -h -r backup

now all protections should be removed.. If this fails, do the same in safe mode to prevent any process using the directory. Then try to delete the directory.
ASKER CERTIFIED SOLUTION
Avatar of dbrunton
dbrunton
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That's correct, i forgot the vista permissions.. so, do the attrib thing i mentioned AND this:

takeown /F dirname /R /D Y

where dirname is the backup directory. I'm not sure which one you will have to do first, just try. Wont brake anything.

IF, for some unknown reason you cant gain the permissions with takeown, follow these steps:

1. Right click on folder (Context menu appears.)
2. Select "Properties" ("[Folder Name] Properties" dialog appears.)
3. Click the "Security" tab.
4. Click "Advanced" button (Advanced Security Settings for [Folder Name] appears.)
5. Click "Owner" tab.
6. Click "Edit" button.
7. Click new owner's name in "Change owner to" box.
8. Click box to check "Replace owner on subcontainers and objects".
9. Click "Apply" button. ("Changing ownership of..." progress message appears.)
10. Click "Yes" to acknowledge "Windows Security" warning.
11. Click OK to close topmost "Advanced Security Settings" dialog.
12. Click "Permissions" tab (first tab) on current "Advanced Security Settings" dialog.
13. Click "Edit" button.
14. Click to select the Administrator in the "Permission Entries" box.
15. NOTE: If "Administrator" appears more than once, select the one that has "Subfolders and files only" in the "Apply To" column.
16. Click Edit button. ("Permission Entry for [Folder Name]" dialog appears.)
17. Click to check "Apply these permissions to objects..." option.
18. Click to check ALL the boxes in the "Allow" column.
19. Click "OK" (Dialog box closes, return to "Advance Security Settings" dialog.)
20. Click to check "Include inheritable permissions..." option.
21. Click to check "Replace all existing inheritable permissions..." option.
22. Click "Apply" button. ("Windows Security" confirmation dialog appears.)
23. Click "Yes" to confirm that you wish to continue.
24. Watch progress indicator on the "Windows Security: Setting security information..." dialog.
25. When all security information has been applied, the progress indicator dialog will close automatically.
26. You are now at the "Advanced Security Settings for [Folder Name]" dialog box... the "Permissions" tab should be visible.
27. Click "OK" and the dialog box closes, revealing the previous dialog box.
28. Click "OK" and the dialog box closes, revealing the "Properties" dialog box.
29. Click "OK" and the "Properties" dialog box closes.
30. Return to Windows Explorer and delete the folder.
Avatar of djkaraok

ASKER

Thanks I will try these out and get back to you. I have cancer and had a treatment today so please be patient before closing this question. Thank You.

Ok I am going to try and will let you know.

Thanks

Jerry

Ok just tried and it did not work. I started doing the order that you stated first without regard to Vista.  I did the attrib -s -h -r /s /d and it displayed "Access Denied -f:\Windows Onecare Backup\jerrylaptop\2007-A\Catalogs\Part 47.zip.catalog"

Then I typed attrib -s -h -r windows onecare backup and it displayed "parameter format not correct -"

Then I typed takedown /f windows onecare backup /r/d/y and it displayed 'takedown' is not recognized as an internal or external command operable program or batch file"

So I am not sure  what to do next.
takeown  NOT takedown
I just ran "takeown /f windows onecare backup /r/d/y" and it returned ERROR: Invalid argument/option - 'f/' Type "takeown /?" for usage"

What is the name of the drive and folder concerned?
It is an external USB drive - "ExternalDrv (f:)" and the folder is "Windows Onecare Backup". I am happy to get rid of the entire folder since I uninstalled OneCare.

Jerry


Try the following at the command line.  Note where the " are used.

takeown /f "f:\windows Onecare Backup" /r /d /y
I typed the following at the F:\ prompt - takeown /f "f:windows onecare backup" /r/d/y
and I received the following message "invalid argument/option - 'f/'
type "TAKEOWN" /f" for usage


takeown  /f   "f:\windows Onecare Backup" /r /d Y

OR

takeown /f "f:\windows Onecare Backup" /r /dY

I placed a / before the Y
I ran takeown /f "f:Windows Onecare Backup"/r/dY and takeown /f "f:/Windows Onecare Backup"/r/dY and takeown /f "f:\Windows Onecare Backup"/r/dY and each of these reported:

ERROR: File or Directory not found.

I checked again and the file folder (directory) reads Windows OneCare Backup as the title so I also ran each of the above situations with Onecare spelled OneCare and it still returned the same error msg.

Try

takeown   /f    "f:\Windows Onecare"  /r/   dY
I tried both the following - takeown /f "f:\Windows Onecare" /r/ dY as well as takeown /f "f:\Windows Onecare" /r /dY and all I get is ERROR: Invalid argument/option - 'Onecare /r/. Type "TAKEOWN /? for usage.

Are we getting anywhere?

Apologies.  I have misplaced a / again.

takeown   /f    "f:\Windows Onecare"  /r   /dY
read post I have already tried takeown /f "f:\Windows Onecare" /r /dY and received the same error message as above.
Let's try


takeown   /f    "f:\Windows*"  /r   /dY
do we really want to do this procedure "takeown" for all windows directories? Windows* will do that if it works properly.



We are doing it on the f: - the USB drive - and not the c:

The Windows* means all folders that start with Windows such as Windows OneCare

Do you have another Windows folder on F: besides the Windows OneCare folder?  If so we'll change the option.

I'm using the * - which is a wildcard - because for some reason it's not getting to the Windows OneCare folder and I'm not sure why.
Actually I only have one windows folder on F: drive. Forgot that we were doing it to drive F: - Am not sure how I forgot that since I have typed it 100 times already lol -

ERROR: Invalid argument/option - '/dY'.
Type "TAKEOWN /?" for usage

I noticed when I ran takeown /? that there are no quotes around c:\windows........ so I tried without " " and got an error for command /dY "invalid argument" so I tried /r/d Y and got invalid argument /r/d

All right, it's getting better.  You're not the only one who's having memory lapses.

Let's try it without the Y

takeown   /f    "f:\Windows*"  /r   /d
ERROR: invalid syntax . Value expected for '/d'.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Wow some new crap lol

takeown /f "f:\Windows*" /r /dY = invalid argument/option - '/dY'

takeown /f "f:\Windows*" /r /d Y = INFO: The current loggen in user does not have ownership priveleges the file <folder>: "f:\Windows OneCare Backup". - ERROR: access denied

takeown /f "f:\Windows*" /r = INFO: The current loggen in user does not have ownership priveleges the file <folder>: "f:\Windows OneCare Backup".

You do not have permission to read the contents of directory "f:$Recycle.bin\S-1-5-21-1800869575-3840655016-335042772-1000".
Do you want to replace the directory permissions with permissions granting you full control <"Y" for Yes, "N" for NO or "C" for cancel?_

Ironically I have a problem on this site that would not let me clear my recycle bin on my external drive that was never really resolved. seems odd that the recycle.bin is mentioned. Will this allow me to clear a recycle bin on an external drive?

I am waiting to reply to this message  on my screen until your reply.



This one is the  correct one.  That's the middle one.  Are you logged in as Administrator?

takeown /f "f:\Windows*" /r   /d Y
In vista you have admin rights for my user - I am the only user - but not really logged in as admin and cannot even say that You can log in as admin.

Should I answer the command prompt as Y?
LOL I selected Y and hit enter and got ERROR: access denied
OK

So something is still holding control of the folder concerned even if you have administrator rights.

Is there anything on the USB disk that you really need because you could do a complete wipe of it and start again?

I won't be responding to email for about 2 hours.  There's some mushrooms that need looking at.
Oh ya I need a lot on my external disk - mushrooms eh enjoy!

Well here is something interesting and maybe you can add it to your knowledge base. I was tired of typing cmd in the start screen so I looked up on how to get a cmd prompt on my desktop. What I found was a was to run a cmd as administrator.

This procedure opens a cmd prompt window with the words Administrator:C:\Windows\system32\cmd
1. hit the Windows key
2. type 'CMD' (excluding the quotes)
3. hold down CTRL and SHIFT and hit ENTER
4. hit ALT + C

So I ran the one cmd line that was working and I got:

SUCCESS: The file<or folder>: "f:\windows onecare backup" now owned by user "jerrylaptop\djkaraok".
Data Error <cyclic redundancy check>.


Then I went to my F drive onecare directory and went into folders until I found a file and tried to delete it and received a message Access Denied - I used cmd del *.* and hit enter then said Y when ask if I wanted to delete the file .

Thought We were on to something. At least I can now open a cmd prompt in Admin mode. That is nice to know.

Jerry
Maybe we have to unlock each file and change the properties of the files now that we can at least try to delete them. But in reality it said that we had rights to the files after our SUCCESS?


Well I just put a cmd prompt on my desktop and all we have to do is right mouse click and use in Admin mode.

Data Error <cyclic redundancy check>

That is not a good message.

/r should have given ownership of the entire OneCare folder and files to Administrator  (yourself).

Did you use Administrator mode to do the deletion?

Try Administrator mode with the following command

del "f:\windows*"
when I type del "f:\windows*" and hit enter no response is shown at dos prompt and when I do dir to see the windows onecare backup folder is still there.

When I type del "f:\Windows OneCare Backup" and hit <enter> I get f:\Windows OneCare Backup\* are you sure <Y/N>? - when I entered Y and hit <enter> I get f:\Windows OneCare Backup\DO_NOT_DELETE.mediaID
Access is denied

I checked my f:\windows onecare backup folder and beneath the main folder is a file called DO_NOT_DELETE.mediaID file and a folder named jerrylaptop that has the backup files.

I also tried to delete the file itself by right mouse clicking and selecting delete - I needed to confirm the deletion and did so and then it said "you need permission to perform this action. and "try again" but does not work.

I just checked and in sub folders there are the following do not delete files Windows Onecare Backup program does not want you to delete these files

DO_NOT_DELETE.globalCatalog - there are two of these files
DO_NOT_DELETE.backupsetID - there are two of these files
DO_NOT_DELETE.mediaID
OK

It looks like the Backup Administrator won't let these files get deleted.



Now is there anything on the USB disk that you really need because you could do a complete wipe of it and start again?
If you need to do a wipe of the disk or delete the folder the following may be of use to you if your laptop can boot off a CDROM disk.

The Knoppix Live CD http://www.knopper.net/knoppix/index-en.html

If you make this disk and boot from it and it recognizes your USB drive you might be able to do disk management on your USB disk.  The Knoppix CD is designed for recovery work and does not write to your hard disk.
Ok so I don't have to go nuts and can delete the files. After a full 12 hours of trying to fix the files so I could delete them via a Dos/Command Prompt and I have reached success without clearing everything off the hard drive.

I went to Windows OneCare site and found the following fix that allowed me to easily change the properties of the folder and then I deleted them and all is ok. Sorry you never found this it would have saved us both hours and hours of work. Here is the following info cut and pasted:

Delete old backup sets

To delete a backup set folder on a single computer:
In Windows XP, click Start, click Run, type explorer.exe, and then press ENTER.


or


In Windows Vista, click Start, click in the Start Search box, type explorer.exe, and then press ENTER.

In My Computer, double-click the drive letter that corresponds to your external hard disk.
In the Windows Live OneCare Backup folder, select the backup set folder, and then press DELETE.
To delete a backup set folder when you use a central backup device (The backup files are stored on a central device that all computers in a OneCare circle can use.) :
Make the current user an owner.
For Windows XP:

On the external hard disk or network share, browse to the location of the Windows Live OneCare Backup folder.
Right-click the OneCare Backup folder, click Properties, and then click the Security tab.
Click Advanced, and then click the Owner tab.
Under Change owner to, click the current user, and then click Replace owner on subcontainers and objects.
Click Apply, and then click OK.


For Windows Vista:

On the external hard disk or network share, browse to the location of the Windows Live OneCare Backup folder.
Right-click the OneCare Backup folder, click Properties, and then click the Security tab.
Click Advanced, click the Owner tab, and then click Edit.
Under Change owner to, click the current user, and then click Replace owner on subcontainers and objects.
Click Apply, and then click OK.
Remove deny permissions to Everyone.
 
For Windows XP:

On the external hard disk or network share, browse to the location of the Windows Live OneCare Backup folder.
Right-click the OneCare Backup folder, click Properties, click the Security tab, and then click Advanced.
On the Permissions tab, under Permission entries, click Type = Deny Name = Everyone, and then press DELETE.
Click Replace permission entries on all child objects with entries shown here that apply to child objects, click Apply, then click OK.


For Windows Vista:

On the external hard disk or network share, browse to the location of the Windows Live OneCare Backup folder.
Right-click the OneCare Backup folder, click Properties, click the Security tab, and then click Advanced.
On the Permissions tab, click Edit.
Click Type = Deny Name = Everyone, and then click Remove.
Click Replace permission entries on all child objects with entries shown here that apply to child objects, click Apply, then click OK.
Give full permission.
 
For Windows XP:

Click Start, click Run, type explorer.exe, and then press ENTER.
Double-click the drive letter that corresponds to your external hard disk.
Right-click the Windows Live OneCare folder, and then click Properties.
On the Security tab, under Groups or user names, click either Administrators or your user name.
Next to Full Control, click Allow, and then click Apply.


For Windows Vista:

Click Start, and then click in the Start Search box.
Type explorer.exe, and then press ENTER.
Under Computer, double-click the drive letter that corresponds to your external hard disk.
Right-click the Windows Live OneCare folder, and then click Properties.
On the Security tab, click Edit, and then under Groups or user names, click either Administrators or your user name.
Next to Full Control, click Allow, and then click Apply.
In the Windows Live OneCare folder, click the backup set folder, and then press DELETE.

I hope this information is valuable to you and now it is in the knowledge base for this site.

Jerry

Awarded Points for effort no solution