fso| Delete Files repeatedly
<%
' |>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>> Aspwizard Copyright 1999-2001 >>>>>>>
' |>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>[Generic File Deletion]>>>>>>>>>>>>>>&G T;>
'| Author:joaquim Jos? Prates Ferreira
'| Date created:13/01/2001
'| Last update:28/06/2001
'| Dependencies:
'| description:this function would delete unwanted files from the server ...
'| v1.1:added a new parameter [Intshowlabel] 0-do not show LABEL/1-show label
'| V1.0:this function only accepts one parameter at the moment, the path with the file,
'| Below there are examples the "how to" call the function.
' |e.g.
'| Call Generic_filedeletion (File path ' REQUIRED ')
'| Call Generic_filedeletion ("MyFile.txt")
'| Call Generic_filedeletion ("Win95/myfile.txt")
'|
'| Please remember to specify a Path, otherwise a Error would occur ...
Function Generic_filedeletion (ByVal strpath,byval Intshowlabel)
' ERROR CHECKING!!!! ...
IF strpath = "" or IsNull (strpath) Then
Response.Write ("Sorry but a path is required when calling this function")
Response.End
End IF
' ERROR CHECKING!!!! ...
IF Intshowlabel = "" or IsNull (Intshowlabel) Then
Response.Write ("Sorry but" paramter <b>intShowLabel</b> is missing. PARAMETER is REQUIRED ")
Response.End
End IF
Filename = Server.MapPath (strpath)
Set fs = CreateObject ("Scripting.FileSystemObject")
If FS. FileExists (filename) Then
Fs. DeleteFile (filename)
If Intshowlabel = 1 Then
Response.Write "File" & "<b> (" & strpath & ") </b>" & "has Been Deleted with success.<br& gt; "
End If
Else
Response.Write "No path is found, or file does not exist to delete...<br>"
End If
End Function
%>
Copy file
<%
' |>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>> ASPWizard.co.uk Copyright 1999-2001 >>>>>>>>>>> >>>>>>
' |>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>[generic_filecopy.asp]>>>>>>>>>>>>>>&G T;>
'| Author:joaquim Jos? Prates Ferreira
'| Last Author:joaquim Jos? Prates Ferreira
'| Date created:26/04/2001
'| Last update:26/04/2001
'| Dependencies:
'| description:this function would copy Files from [A] to [B]
'| V1.0:this function would copy a file from one Folder to another.
'|
'| Parameters:
'| Strfilesource-we specify the path to the file to Copy
'| Strfiledestination-we sepcify The path to the new file
'| Stroverwrite-we say if We want to overwright a file
'|
'| e.g:
'| Call Generic_filecopy ("D:\Xkudos\NewsX_1997.mdb", "D:\Xkudos\Xkudos\Xkudos\DB\NewsX_1997.mdb", True)
Function generic_filecopy (ByVal strfilesource,byval strfiledestination,byval stroverwrite)
'--------------------------------[ERROR CHECKING]--------------------------------
' ERROR CHECKING!!!! ...
IF Strfilesource = "" or IsNull (Strfilesource) Then
Response.Write ("Sorry but a File Source path is required when calling this function")
Response.End
End IF
' ERROR CHECKING!!!! ...
IF strfiledestination = "" or IsNull (strfiledestination) Then
Response.Write ("Sorry but a File destination path is required while calling this function")
Response.End
End IF
' ERROR CHECKING!!!! ... [True-false]
IF stroverwrite = "" or IsNull (stroverwrite) Then
Response.Write ("Sorry but a File destination path is required while calling this function")
Response.End
End IF
'--------------------------------[/error checking]--