asp OpenTextFile文本读取与写入实例代码

2019-01-13 11:20:47刘景俊

易采站长站写的一个判断文件是否被更改过的代码

Dim fso Set fso = CreateObject("Scripting.FileSystemObject") set fn2=fso.GetFile("E:webrootjb51index2.htm") flsize2=fn2.size fldate2=fn2.datelastmodified set fn=fso.GetFile("E:webrootjb51index.htm") flsize1=fn.size fldate1=fn.datelastmodified If fso.FileExists("E:webrootjb51index2.htm") and flsize2>50000 and fldate2>fldate1 Then '判断文件的大小,如果html文件重新生成需要判断是否更新过且文件不能小于50K fso.getfile("E:webrootjb51index2.htm").copy("E:webrootjb51index.htm") if err.number=0 then WriteHistory "成功"&now()&".........","log.txt" end if '日志写入函数 Sub WriteHistory(hisChars, path) Const ForReading = 1, ForAppending = 8 Dim fso, f Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile(path, ForAppending, True) f.WriteLine hisChars f.Close End Sub

您可能感兴趣的文章:

asp(vbs)fso OpenTextFile方法参数说明