Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete a simple text file 1

Status
Not open for further replies.

jbs

Programmer
Feb 19, 2000
121
US
How do I delete a simple text file on the server that is running my ASP file? I already know how to create a file, open a file, read a file, write to a file....but I can't find documentation on how to delete a simple text file.

Example:

Let's say there is a file called "deletethis.txt" located on the web server in the folder "c:\TheFolder\".

Given that I already have a string variable that contains the full path name to the file, (let's call it "strPathName"), how do I delete the file?

thanks,

Jerry
 
How about using FileSystemObject method:
DeleteFile

or try File Object

<%
Set fsoObject = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set fileObject = fsoObject.GetFile(&quot;path to the file\filename&quot;)
fileObject.Delete True
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top