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