<p>一组FSO相关FUNCTION,常用代码</p>
<p>删除文件<br />
<%<br />
'|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ASPWizard Copyright ?1999-2001 >>>>>>><br />
'|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[ Generic File Deletion ]>>>>>>>>>>>>>>>><br />
'|Author: Joaquim Jos?Prates Ferreira<br />
'|Date Created: 13/01/2001<br />
'|Last Update: 28/06/2001<br />
'|Dependencies:<br />
'|Description: This function will delete unwanted files from the server...<br />
'| V1.1: Added a new parameter [ intShowLabel ] 0 - Do not show label / 1 - Show label<br />
'| V1.0: This function only accepts one parameter at the moment, the path with the file,<br />
'| below there are examples of how to call the function.<br />
'|e.g.<br />
'| Call Generic_FileDeletion(File path 'REQUIRED')<br />
'| Call Generic_FileDeletion("myfile.txt")<br />
'| Call Generic_FileDeletion("win95/myfile.txt")<br />
'|<br />
'|Please remember to specify a Path, otherwise an Error will occur...</p>
<p>Function Generic_FileDeletion(byval strpath,byval intShowLabel)</p>
<p>' ERROR CHECKING!!!!...<br />
IF strpath = "" or isnull(strpath) then<br />
Response.Write("Sorry but a path is required when calling this function")<br />
Response.End<br />
End IF</p>
<p>' ERROR CHECKING!!!!...<br />
IF intShowLabel = "" or isnull(intShowLabel) then<br />
Response.Write("Sorry but the paramter <b>intShowLabel</b> is missing. PARAMETER IS REQUIRED")<br />
Response.End<br />
End IF</p>
<p>Filename = Server.MapPath(strpath)</p>
<p>Set fs = CreateObject("Scripting.FileSystemObject")</p>
<p> If fs.FileExists(filename) Then<br />
fs.DeleteFile(filename)</p>
<p> if intShowLabel = 1 then<br />
response.write "File" & " <b>(" & strpath & ")</b> " & " has Been Deleted with Success.<br />
"<br />
end if<br />
Else<br />
response.write "No path was found, or file does not exist to delete...<br />
"<br />
End If</p>
<p>End Function<br />
%></p>
<p></p>
<p></p>
<p>copy文件</p>
<p><br />
<%<br />
'|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ASPWizard.co.uk Copyright ?1999-2001 >>>>>>>>>>>>>>>>><br />
'|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[ Generic_FileCopy.asp ]>>>>>>>>>>>>>>>><br />
'|Author: Joaquim Jos?Prates Ferreira<br />
'|Last Author: Joaquim Jos?Prates Ferreira<br />
'|Date Created: 26/04/2001<br />
'|Last Update: 26/04/2001<br />
'|Dependencies:<br />
'|Description: This function will copy Files From [ A ] to [ B ]<br />
'| V1.0: This function will copy a file from one Folder to another.<br />
'|<br />
'|Parameters:<br />
'| strFileSource - We specify the path to the file to Copy<br />
'| strFileDestination - We sepcify the path to the new file<br />
'| strOverWrite - We say if we want to overwright a file<br />
'|<br />
'|E.G:<br />
'| Call Generic_FileCopy("D:XkudosNewsX_1997.mdb","D:XkudosXkudosXkudosDBNewsX_1997.mdb",True)<br />
Function Generic_FileCopy(ByVal strFileSource,ByVal strFileDestination,ByVal strOverWrite)<br />
'--------------------------------[ERROR CHECKING]--------------------------------<br />
' ERROR CHECKING!!!!...<br />
IF strFileSource = "" or isnull(strFileSource) Then<br />
Response.Write("Sorry but a File Source path is required when calling this function")<br />
Response.End<br />
End IF<br />
' ERROR CHECKING!!!!...<br />
IF strFileDestination = "" or isnull(strFileDestination) Then<br />
Response.Write("Sorry but a File Destination path is required when calling this function")<br />
Response.End<br />
End IF<br />
' ERROR CHECKING!!!!...[True - False]<br />
IF strOverWrite = "" or isnull(strOverWrite) Then<br />
Response.Write("Sorry but a File Destination path is required when calling this function")<br />
Response.End<br />
End IF<br />
'--------------------------------[/ERROR CHECKING]--</p>