当前位置:首页 >> 网络编程

如何获知文件被改动的情况?

Function File_GetLastModified( sFile )

Dim objFileObj, objFile

 

Set objFileObj = CreateObject("Scripting.FileSystemObject")

  If sFile = "" Then

  sFile = Server.MapPath( Request.ServerVariables

("script_NAME") )

  End If

 

  Set objFile = objFileObj.GetFile(sFile)

 

  File_GetLastModified = objFile.DateLastModified

End Function

 

Response.Write "记录文件被修改:" & File_GetLastModified

("d:\shenzhaoyang\record.txt")

Response.Write "糟了,这个文件已被修改过!" & File_GetLastModified("")

[1]