PDA

View Full Version : delete file script


Mhtml
09-04-2002, 10:25 AM
Hi, I'm having some real problems with some of my code.

I've made a script that deletes a specified file but it whent wrong and onwly paritally deleted the file and now the file that it was meant to delete can't be deleted or changed in anyway, not through dos or windows.

here's the scripts but if you are going to test it be warned it may not work the way it is meant to..

<% Dim GetFile
GetThis = Server.MapPath("messages.htm")
set fs = CreateObject("Scripting.FileSystemObject")
set file = fs.GetFile(GetThis)
file.delete
file.close
Response.Write("File Deleted")%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

</body>
</html>

Roy Sinclair
09-04-2002, 05:33 PM
That sounds more like a file system problem than a code problem. Time to an integretry check on the disk.

Roy Sinclair
09-04-2002, 06:13 PM
FWIW, I tried your code on my system and it works without any of the symptoms you described. W2K Server SP2, IIS 5.

whammy
09-07-2002, 11:38 PM
Last time I ended up with a corrupted file like that (which didn't have anything to do with .asp, I might add) the only way to get rid of it was to format!

If all else fails just change the name of the file you're working with to see if you can get around the problem like that.

Mhtml
09-08-2002, 02:51 AM
It wasn't my code, because even some of my images and things like style sheets were becomming corrupted.

After several reboots a few whent back to normal but the rest didn't so I got a corrupted file remover program and it worked first go..

whammy
09-08-2002, 04:09 PM
Cool... but if I were you, I'd scan for viruses (after updating your antivirus program) just to be safe - that many files corrupted is suspicious.