• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 493
  • Last Modified:

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?
0
Adam
Asked:
Adam
  • 3
  • 3
  • 2
  • +4
1 Solution
 
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
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

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