Solved

Unable to delete files

Posted on 2011-09-19
12
436 Views
Last Modified: 2012-06-21
I have a folder in a website (Windows 2003, IIS6), which caches blocks of HTML for later reuse, to improve site speed.

Some of the files cannot be deleted though, because of an error in their name.

An example file name is search_results.asp%3Fkeywords%3Dwrapper%26category%3D.

If I try to delete the file in DOS, I get the message:

E:\InetPub\www\cache>del "search_results.asp%3Fkeywords%3Dwrapper%26category%3D."
Could Not Find E:\InetPub\www\cache\search_results.asp%3Fkeywords%3Dwrapper%26category%3D.

Open in new window


If I try to delete the file in Windows Explorer, I get a popup message that reads:
"cannot delete file: Cannot read from the source file or disk."

Same result if I try to rename the file in DOS or Windows

I also get the same problem if I try to delete the parent folder, 'cache'

Any suggestions on how to delete these files?
0
Comment
Question by:Cyber-spy
  • 3
  • 3
  • 2
  • +4
12 Comments
 
LVL 3

Expert Comment

by:dahesi
Comment Utility
hi,

could you maybe rename the files into simple names to delete them?
but it sounds like tons of files there..
0
 
LVL 9

Expert Comment

by:Lance_P
Comment Utility
DOS cannot find it because it might be hidden or marked as a system file.

http://ss64.com/nt/del.html

try to remove the attributes and then del it. You might want to stop the ISS service when you do this so that the file is not in use.
0
 
LVL 9

Expert Comment

by:Lance_P
Comment Utility
another quick method, delete the folder 'cache' and create a new folder :)
0
 
LVL 7

Expert Comment

by:Hamid Reza Molahadi
Comment Utility
Pocket KillBox is a program that can be used to get rid of files that stubbornly refuse to allow you to delete them.
http://majorgeeks.com/download.php?det=4709
0
 
LVL 2

Expert Comment

by:UnicornBoy
Comment Utility
Use Unlcoker 1.9.1 : http://www.emptyloop.com/unlocker/
It's a very light freeware for deleting those kinds of files. and has more functionalities.

for how to prevent your system making that kinds of file. post another question.
0
 
LVL 87

Expert Comment

by:rindi
Comment Utility
Disable your IIE services and then try deleting the files again, or boot into safe mode and delete them from there.
0
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 
LVL 2

Expert Comment

by:UnicornBoy
Comment Utility
This file of yours may have two reasons that refuses delete.
1- the original file name contain unsupported characters. (e.g. "?")
2- file is in use by IIS or other web-related services.

You can stop the service or application that has an open handle to the file, so you could delete it.
But the error you described most likely is because of the wrong file name. you have to delete this kind of files with any kind of force delete programs.


Unlcoker 1.9.1 is best of them because it can bypass all kind of troubles and Delete/Rename/Move/Copy files/folders.
Troubles like long file names or paths, bad file names, broken file system table information such as indexes, etc. , bad sectors, open handles by other processes (you can choose to close the handle without interrupting the program that opened it, or even kill the process), security issues (e.g. NT permissions that you or system blocked your self by admin rights that can be removed).
at the end if it can not handle the trouble it suggest to reboot and do it's best on next boot.
0
 
LVL 43

Accepted Solution

by:
Steve Knight earned 500 total points
Comment Utility
Try loading command instead of cmd.exe and it will try using the "short" 8.3 name for the file:

start | run | command.com (or start a cmd.exe prompt and type command.com)

e:
cd \www\inetpub\cache
dir /x

dir /x will show you the short and long names for each file

del short~1.xxx

You could also try using wildcards?

del *.asp

Steve
0
 
LVL 43

Expert Comment

by:Steve Knight
Comment Utility
Incidentally the characters involved there in the filename really shouldn't cause an issue as they will be ignored in their encoded form (though they would of course be an issue if included in the filename unencoded):

%26 &
%3d =
%3f ?

I wonder if there is some other characters involved there, e.g. trailing or leading chars?  Could the files have been marked hidden or system or read only?  Have a look with

attrib search_results.asp*
0
 
LVL 12

Author Closing Comment

by:Cyber-spy
Comment Utility
This worked perfectly.

I didn't need to use command.com (Actually, I tried, but it was not recognised - if it's on the server, it's not to be found anywhere in the PATH)

cmd.exe worked just as well though - the trick which made it work was using the short file names.

Thanks to everyone else for their contributions. However, this was not a file locking issue, but a file name issue. I'd already tried renaming, but that didn't work either.
0
 
LVL 2

Expert Comment

by:UnicornBoy
Comment Utility
Unlocker would also work on that ;)
once you use it you get used to it, it's a must-have tool for everyone.
0
 
LVL 43

Expert Comment

by:Steve Knight
Comment Utility
2003 should have command.com still but maybe hidden/moved/whatever.

Originally was just going to suggest accessing through command.com before idea of just getting short name with /x.  

Unlocker is useful agreed.... but in this case it did sound like was just simple clash of OS not being able to access certain filenames so either using wildcards or short filenames nearly always gets around those.

Glad it helped anyway!

Steve
0

Featured Post

Don't lose your head updating email signatures!

Do your end users still have the wrong email signature? Do email signature updates bore you or fill you with a sense of dread? You can make this a whole lot easier on yourself by trusting an Exclaimer email signature management solution. Over 50 million users do...so should you!

Join & Write a Comment

Solid State Drive Performance Tips: Solid state storage technology is now a standard.  After testing and using several different brands and revisions of SSD's over the years I have put together a collection of tips,tools and suggestions that I ha…
Having issues meeting security compliance criteria because of those pesky USB drives? Then I can help you! This article will explain how to disable USB Mass Storage devices in Windows Server 2008 R2.
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…
This Micro Tutorial will teach you how to reformat your flash drive. Sometimes your flash drive may have issues carrying files so this will completely restore it to manufacturing settings. Make sure to backup all files before reformatting. This w…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now