Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1018
  • Last Modified:

can't delete a file

I restored thousands of files from ntbackup to a folder c:\restore, only to decide I needed later to delete this folder.  One file kept me from doing so.  It's attributes are HSA, it's 0 bytes.  If I attempt to delete in Windows Explorer I get:

"Error deleting File or Folder"
Cannot delete file: cannot read from the source file or disk.

I was able to take ownership with other files and delete.  I ended up finding the troubling file, selecting it, inverting my selection and deleted everything else no problem.  It's not causing a big problem for me, but I'd like to understand what's going on.

I can see the file.  I unhid System and Hidden files.  I ran a CHKDSK on the drive which found no problems. CA8HMJKT. is the filename.
0
pcrequest
Asked:
pcrequest
  • 8
  • 3
  • 3
  • +5
1 Solution
 
sonic4269Commented:
try Checking  Effective Permissions.   Right click - properties - Security tab.  Click Advanced - Effective Permissions.  Type in the username you are logged in under. and make sure you have the "delete" permission for the file.

IF you do, and still can't delete it try doing it from a command prompt.

Start - Run then type CMD and hit OK

at the dos box type

cd C:\restore  (or whatever path the file is located in)
del *.*
0
 
sk_raja_rajaCommented:
it looks like corrputed
0
 
JNRCSCommented:
Try:

Right click file and select Open With.
Select notepad.
It should give you an error like "This file does not exist, would you like to create a new one?"
Do so.
Write miscellaneous data into it and save.
Delete the file.

Does the file happen to end in a "." ?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
sk_raja_rajaCommented:
1.did you try to delete them in sage mode?
2.Open a Command Prompt window and leave it open. Close all open programs. Click Start, Run and enter TASKMGR.EXE Go to the Processes tab and End Process on Explorer.exe. Leave Task Manager open. Go back to the Command Prompt window and change to the directory the undeletable file is located in. At the command prompt type DEL where is the file you wish to delete. Go back to Task Manager, click File, New Task and enter EXPLORER.EXE to restart the GUI shell. Close Task Manager.

Can't delete file or folder:
  http://support.microsoft.com/?kbid=320081
  http://www.theeldergeek.com/delete_undeletable_file.htm 

3.deleting with wild cards at a DOS prompt can help, or if possible deleteing all files in that folder.  Renaming file to something very short and then deleting might fix the problem you're experiencing.  If the file is in use I might recommend downloading Process Explorer from http://www.sysinternals.com/  You can search for an open file and what process it belongs to.
0
 
sk_raja_rajaCommented:
0
 
ctprofCommented:
Go into a command prompt and do the following...
cd \restore
attrib -s -h CA8HMJKT
del CA8*.*
If the file still does not delete, go into safe mode with command prompt and try the del command from that directory.
0
 
pcrequestAuthor Commented:
JNRCS

Yes it ends in a dot.  I do as you say with notepad, but a new file is created without ending in dot.  This doens't overwrite the original.
0
 
pcrequestAuthor Commented:
If I do a dir at the cmd prompt, it lists 0 files in the directory, therefore del, attrib don't work.

I ran a Process Monitor trace and saw results like

NAME NOT FOUND
NO SUCH FILE
0
 
pcrequestAuthor Commented:
the file is not in use.  There is no Security tab when checking properties.
0
 
ctprofCommented:
dir is not going to work because on the file is the attribute H.  If you go to the command prompt and change to that directory and just type attrib and hit enter it should list the file with the hidden and system attribute on it.  Then you will have the complete file name.  Then you do as stated in previous post..
attrib -s -h filename    then hit enter.  at this point you should be able to do a dir, see the file and delete the file.
0
 
pcrequestAuthor Commented:
I tried some special sytax for files with invalid names:

C:\restore>del "\\?\c:\old restore\CA8HMJKT."
Could Not Find \\?\c:\old restore\CA8HMJKT.

http://support.microsoft.com/default.aspx?scid=kb;en-us;320081  (see cause 6). Interesting article.

Still didn't work.  
0
 
pcrequestAuthor Commented:
ctprof,

OK, so dir doesn't list it, but attrib did like you last said, however check out the last line of this post.


C:\old restore>attrib
A  SH      C:\old restore\CA8HMJKT.

C:\old restore>dir
 Volume in drive C has no label.
 Volume Serial Number is redacted

 Directory of C:\old restore

10/08/2008  04:00 PM    <DIR>          .
10/08/2008  04:00 PM    <DIR>          ..
               0 File(s)              0 bytes
               2 Dir(s)  50,591,645,696 bytes free

C:\old restore>attrib -s -h CA8HMJKT.
File not found - CA8HMJKT.
0
 
ctprofCommented:
try this.. in that same directory.. type attrib -s -h *.*
0
 
rpggamergirlCommented:
Have you tried Unlocker? it's a great program for files/folders that are hard to delete.
http://ccollomb.free.fr/unlocker/

Just rightclick on the file and click "Unlock All" and delete.
 http://ccollomb.free.fr/unlocker/unlocker1.8.7.exe
0
 
pcrequestAuthor Commented:
Tried the crazy subinacl but didn't work:

C:\Program Files\Windows Resource Kits\Tools>subinacl /onlyfile "\\?\C:\oldresto
re\CA8HMJKT." /setowner=administrator /grant=administrator=F
\\?\C:\oldrestore\CA8HMJKT. : dc\administrator is the new owner
\\?\C:\oldrestore\CA8HMJKT. : new ace for dc\administrator
\\?\C:\oldrestore\CA8HMJKT. : 2 change(s)


Elapsed Time: 00 00:00:00
Done:        1, Modified        1, Failed        0, Syntax errors        0
Last Done  : \\?\C:\oldrestore\CA8HMJKT.

C:\Program Files\Windows Resource Kits\Tools>cd c:\oldrestore\

C:\oldrestore>attrib
A  SH      C:\oldrestore\CA8HMJKT.

C:\oldrestore>dir
 Volume in drive C has no label.
 Volume Serial Number is 5092-9BCA

 Directory of C:\oldrestore

10/08/2008  04:00 PM    <DIR>          .
10/08/2008  04:00 PM    <DIR>          ..
               0 File(s)              0 bytes
               2 Dir(s)  50,590,519,296 bytes free

C:\oldrestore>del "\\?\C:\oldrestore\CA8HMJKT."
Could Not Find \\?\C:\oldrestore\CA8HMJKT.
0
 
chingmdCommented:
Have you tried tab completion?  Maybe there are some unprintable characters in the name.
What about renaming the file?  Using a command line or in explorer.   (make sure you have show hidden and system files on, and do not hide file extention for know file types selected.)  

Another way that I've been able to do this is to share the folder.   Then from a linux box, connect to the share and delete from the command line there.

what about a wild card match up?  

You might also look at the program processexplorer from sysinternals to see if something is holding that file open.
0
 
llmanCommented:
Did you try: del "\\?\C:\oldrestore\CA8HMJKT.*" or del "\\?\C:\oldrestore\CA8HMJKT*"

Does "dir /x" show a different name for the file that can be used?

0
 
pcrequestAuthor Commented:
llman

I tried the wildcards, but they didn't work

C:\oldrestore>del "\\?\c:\oldrestore\CA8HMJKT.*"
Could Not Find \\?\c:\oldrestore\CA8HMJKT.*

C:\oldrestore>del "\\?\c:\oldrestore\CA8HMJKT*"
Could Not Find \\?\c:\oldrestore\CA8HMJKT*

C:\oldrestore>dir /x
 Volume in drive C has no label.
 Volume Serial Number is 5092-9BCA

 Directory of C:\oldrestore

10/08/2008  04:00 PM    <DIR>                       .
10/08/2008  04:00 PM    <DIR>                       ..
               0 File(s)              0 bytes
               2 Dir(s)  50,590,371,840 bytes free

C:\oldrestore>attrib
A  SH      C:\oldrestore\CA8HMJKT.
0
 
pcrequestAuthor Commented:
Connecting from a linux machine to it as a Windows share was the only way I was able to delete it.
0

Featured Post

New Tabletop Appliances Blow Competitors Away!

WatchGuard’s new T15, T35 and T55 tabletop UTMs provide the highest-performing security inspection in their class, allowing users at small offices, home offices and distributed enterprises to experience blazing-fast Internet speeds without sacrificing enterprise-grade security.

  • 8
  • 3
  • 3
  • +5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now