[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Unable to delete files

Posted on 2011-09-19
12
Medium Priority
?
486 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:Adam
  • 3
  • 3
  • 2
  • +4
12 Comments
 
LVL 3

Expert Comment

by:dahesi
ID: 36559040
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
ID: 36559043
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
ID: 36559045
another quick method, delete the folder 'cache' and create a new folder :)
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 7

Expert Comment

by:Hamid Reza Molahadi
ID: 36559046
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
ID: 36559047
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 88

Expert Comment

by:rindi
ID: 36559063
Disable your IIE services and then try deleting the files again, or boot into safe mode and delete them from there.
0
 
LVL 2

Expert Comment

by:UnicornBoy
ID: 36559077
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 2000 total points
ID: 36559115
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
ID: 36559153
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:Adam
ID: 36559211
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
ID: 36559375
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
ID: 36559440
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

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
How much do you know about the future of data centers? If you're like 50% of organizations, then it's probably not enough. Read on to get up to speed on this emerging field.
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…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

834 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