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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting a file from server

Status
Not open for further replies.

Gazosdeamigos

Programmer
Feb 19, 2004
10
GB
Help i need to know the command to delete a file from a directory on my server. to upload i use

Filename = objUpload.Fields("filename").value

strPath = Server.MapPath("..\uploads\prop") & "\" & FileName

objUpload.Fields("filename").SaveAs strPath

does any1 know the command to delete thanx
 
You need to use FSO
Code:
<%
strFolder = "C:\Temp\myFolder"
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFolder(strFolder, True)
Set objFSO = Nothing
%>
The True parameter will ensure the folder gets deleted even if it is read only.

Tony
________________________________________________________________________________
 
<%
strFolder = "C:\Temp\myFolder"
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFILE(PATH & FILENAME)
Set objFSO = Nothing
%>

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top