For whatever reason, there are times when it would be convenient to know how to delete a file without having to go to the server to do it. This is just one of the things you can do with the File Scripting Object Author: Derek Truman Code: ASP 3.0 & VBScript
|Just The Way I Like It!! |
Written by Doug Hunsucker from Orlando, FL (Thursday, January 26, 2006)
Writer is with: http://siteperceptions.com/
||Strengths: Simple, Room for customizing.
Details: Clean and simple! Love it! I use a database to set the variables for files that are no longer in use on the website and just needed something to delete them and this was it!
Review Based On: using demo only
it works well
Written by Anonymous User (#1619-313) from Kansas (Thursday, August 21, 2003)
||Strengths: worked the first time I tried it
Details: I adapted this for use with querystring, which makes it also easy to adapt for use with filenames listed in a database:
'this line creates an instance of the File Scripting Object named myFSO
SET myFSO = Server.CreateObject("Scripting.FileSystemObject")
'error handling here to make sure that things go smoothly
'if the file does not exist
If myFSO.FileExists("D:\html\gallery\"&request.querystring("file")) Then
'then we delete it
'otherwise we tell the client it does so they don't get a nasty error
Response.Write "THIS FILE DOESN'T EXIST"
'this line destroys the instance of the File Scripting Object named myFSO
SET myFSO = NOTHING
response.write "FILENAME"& " " & request.querystring("file") & " " & "DELETED"
Review Based On: 1 Hour(s) of usage
Written by Anonymous User (#1311-170) from Beaumont (Friday, August 09, 2002)
||Strengths: no comment
Weaknesses: no comment
Details: This code worked great for me. I didnt have to do any modifications to get it to work, all I had to change was the file location. Thanks for the code.
Review Based On: 2 Day(s) of usage