| 网站首页 | 资讯 | 影音 | 图片 | 论坛 | 模拟驾考 | 免费取名算命 | 瓷都工具 | 留言本 | 域名 | 瓷都商城 | 汇款 | 
您现在的位置: 瓷都热线|诚信中国:“一就是一”(1941.CN) >> 资讯 >> 教程技巧0 >> 网络编程 >> 正文 登录 注册
专 题 栏 目
最 新 热 门
最 新 推 荐
相 关 文 章
Windows2003下提高FSO的
FSO专题 : 文本搜索
Microsoft Windows 2000
给你的FileSystemObject
如何在服务器上禁止FSO?
用ADODB.Stream代替FSO读
文件遍历排序函数
构建免受 FSO 威胁虚拟主
ASP中FSO对象对IIS WEB服
一组FSO相关FUNCTION,常用代码         ★★★
一组FSO相关FUNCTION,常用代码
作者:Andy.m 文章来源:Andy.m 更新时间:2003-12-8 2:13:23
【声明:转载此信息在于传递更多信息,其内容表达的观点并不代表本站立场,由这些信息所产生的一切后果本站不负任何责任。如果您对本信息有什么意见,欢迎和本站联系,谢谢!】http://CiDu.Net

删除文件
<%
'|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ASPWizard Copyright ?1999-2001 >>>>>>>
'|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[       Generic File Deletion      ]>>>>>>>>>>>>>>>>
'|Author: Joaquim Jos?Prates Ferreira
'|Date Created: 13/01/2001
'|Last Update: 28/06/2001
'|Dependencies:
'|Description: This function will 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 of 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 an Error will 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 the 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>"
   end if
  Else
   response.write "No path was found, or file does not exist to delete...<BR>"
  End If

End Function
%>





copy文件


<%
'|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ASPWizard.co.uk Copyright ?1999-2001 >>>>>>>>>>>>>>>>>
'|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[       Generic_FileCopy.asp       ]>>>>>>>>>>>>>>>>
'|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 will copy Files From [ A ] to [ B ]
'| V1.0: This function will 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 when 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 when calling this function")
Response.End
End IF
'--------------------------------[/ERROR CHECKING]--------------------------------
Set fso = CreateObject("Scripting.FileSystemObject")
    
If fso.FileExists(strFileSource) Then
  fso.CopyFile strFileSource, strFileDestination, strOverWrite
Else
  Response.Write("The file does not exist...")
  Response.End
End If
    
Set fso = Nothing
End Function
%>
写文件


<%
'|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ASPWizard Copyright ?1999-2002 >>>>>>>>>>>>
'|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[       Generic_FileWriter.asp ]>>>>>>>>>>>>>>>>>
'|Author: Joaquim Jos?Prates Ferreira
'|Last Author: Joaquim Jos?Prates Ferreira
'|Date Created: 24/02/2002
'|Last Update: 24/02/2002
'|Dependencies:
'|Description: This function will write a file, you just need to pass 3
'|                parameters.  And you will create files in you folder, quick and easy
'| V1.0:
'|
'|Parameters:
'| strFileName         - Required Parameter
'| strFileExtension - Required Parameter
'| strFileContent     - Required Parameter
'|
'| Example of Call:
'|        CAll Generic_FileWriter("MyFileName","HTML","The content goes here...")


Function Generic_FileWriter(strFileName,strFileExtension,strFileContent)

Set oFS = CreateObject("Scripting.fileSystemObject")
Set oTXS = oFS.OpenTextFile(Server.MapPath(strFileName & "." & strFileExtension),8,True)

oTXS.WriteLine(strFileContent)
oTXS.Close

End Function
%>

更棒的


<%
'|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ASPWizard Copyright ?1999-2001 >>>>>>>>>
'|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>[       Generic_FileFerrete.asp          ]>>>>>>>>>>>
'|Author: Joaquim Ferreira
'|Date Created: 19/02/2001
'|Last Update: 20/02/2001
'|Last Author: Joaquim Ferreira
'|Dependencies: A Folder to Search On
'|Description: The following function will go to a specific folder specified by the parameter (strDirectory)
'|    And display the contents of that folder  with a URL to it.
'|  V1.1: Added the Error Checking statements to the function
'|  V1.0:
'| The current variables are:
'|
'| strDirectory - We specify the Folder Path
'| dtStartingDate - It is is required a starting criteria
'| dtEndingdate - It is is required a Ending criteria
'| intqued   - It decides if we using the queue directory or not (0 - No / 1 - Yes)
'|
'| Example:
'|  Call FileFerret(strDirectory, dtStartingDate, dtEndingdate,intqued)
'| Normal Usage:
'|  Call FileFerret("/desktop/ASP_odds/Generic_Funcs/test/","19/02/2001 00:00:00","20/02/2001 16:16:34",0)
'|  When using on queued directory:
'|  Call FileFerret("/desktop/ASP_odds/Generic_Funcs/test/","19/02/2001 00:00:00","20/02/2001 16:16:34",1)

Function FileFerret(ByVal strDirectory,ByVal dtStartingDate,ByVal dtEndingdate,ByVal intqued)
Dim intBadcounter ' It will count how many bad emails there are
Dim intquedCounter

intBadcounter = 0
intquedCounter = 0

'-----------------------[ START ERROR CHECKING ]---------------------------
' Checks if there is a ( directory )defined in the parameter
If strDirectory = "" or isnull(strDirectory) Then
  Response.Write("The parameter for Directory is missing - IT IS A REQUIRED PARAMETER!")
  Response.End
End If

' Checks if the ( Starting Date ) Parameter is missing
If dtStartingDate = "" or isnull(dtStartingDate) Then
  Response.Write("The Starting Date parameter is missing - IT IS A REQUIRED PARAMETER!")
  Response.End
End If

' Checks if the ( Ending Date ) Parameter is missing
If dtEndingdate = "" or isnull(dtEndingdate) Then
  Response.Write("The Ending Date parameter is missing - IT IS A REQUIRED PARAMETER!")
  Response.End
End If

' Checks if the ( intqued ) Parameter is missing
If intqued = "" or isnull(intqued) Then
  Response.Write("The intqued parameter is missing - IT IS A REQUIRED PARAMETER!")
  Response.End
End If
'-----------------------[ END ERROR CHECKING ]---------------------------

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(server.mappath(strDirectory))
Set fc = f.files

%>
<H1><%=strDirectory%></H1>
<HR>
<Table Border="0" Cellpadding="0" Cellspacing="3" Align="Center">

<%
For Each File in fc
intquedCounter = intquedCounter + 1
  ' It checks if it is in between a certain Time limite
  If formatdatetime(File.datecreated ,0) >= dtStartingDate and formatdatetime(File.datecreated ,0) <= dtEndingdate Then

   ' Checks if it is an Email
   If right(File.Name,4) = ".msg" or  right(File.Name,4) = ".eml" Then
    IMG = "img/email.gif"
   End If

   ' Checks if it is a log file or a Text File
   If right(File.Name,4) = ".log" or  right(File.Name,4) = ".txt" Then
    IMG = "img/txt.jpg"
   End If

   ' Checks if it is a BAD email file
   If right(File.Name,4) = ".bad" Then

    ' Increases the Bad emails counter by 1
       intBadcounter = intBadcounter + 1
    IMG = "img/emailbad.gif"
   End If
%>
<TR>
<TD align="center"><img src="<%=IMG%>"></TD>
<TD><A HREF='<%=strDirectory & File.name%>'><%=File.name%></a></TD>
<TD><%=formatdatetime(File.datecreated ,0)%></TD>
</TR>
<%
  End If
Next

%>
<TR>
<TD>There are </TD><TD><b><%=intBadcounter%></b> bad emails.</TD>
</TR>
<%
' We check if we using the queue directory (0 - No / 1 - Yes)
IF intqued = 1 Then %>
<TR>
<TD>There are </TD><TD><b><%=intquedCounter%></b> emails awating to be sent.</TD>
</TR>
<% End If %>
</Table>

<%
End Function
%>


声明:以上信息资料大都是网上搜集而来,版权归作者,如有版权问题请留言告知我将马上改正。
文中所提到的各种观点只是原文观点,各种说法未经一一确认。并不代表本站认可此观点!!
资讯录入:ahui    责任编辑:ahui 
  • 上一篇资讯:

  • 下一篇资讯:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    点击数:
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)