Unable to delete files

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?
LVL 12
AdamSenior DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dahesiCommented:
hi,

could you maybe rename the files into simple names to delete them?
but it sounds like tons of files there..
0
Lance_PCommented:
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
Lance_PCommented:
another quick method, delete the folder 'cache' and create a new folder :)
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Hamid Reza MolahadiCommented:
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
UnicornBoyCommented:
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
rindiCommented:
Disable your IIE services and then try deleting the files again, or boot into safe mode and delete them from there.
0
UnicornBoyCommented:
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
Steve KnightIT ConsultancyCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Steve KnightIT ConsultancyCommented:
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
AdamSenior DeveloperAuthor Commented:
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
UnicornBoyCommented:
Unlocker would also work on that ;)
once you use it you get used to it, it's a must-have tool for everyone.
0
Steve KnightIT ConsultancyCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.