VB 检测网络文件的修改时间
2010-10-14 20:31
155 查看
用VB 检测一个网络的DAT或者EXE文件的修改时间或者MD5码之类的,主要就是想知道这个网络文件有没有改变,请不要说下载下来在检测,那个文件几G 根本不行!只要可以达到知道网络那个文件是不是有修改了就行了
http://zhidao.baidu.com/question/159150923.html
直接使用以下模块
Private Sub Form_Load() url = "http://zhidao.baidu.com/question/159150923.html" url = "http://www.baidu.com/img/baidu_logo.gif" Set XMLHTTP = CreateObject("Microsoft.XMLHTTP") XMLHTTP.Open "HEAD", Trim(url), False XMLHTTP.send MsgBox XMLHTTP.getAllResponseHeaders If InStr(1, XMLHTTP.getAllResponseHeaders, "Last-Modified") Then MsgBox "文件最后更新时间:" & GMT_Trans(XMLHTTP.getResponseHeader("Last-Modified")) End If End Sub Function GMT_Trans(s_time) str_time = Mid(s_time, InStr(1, s_time, ",") + 1, InStr(1, s_time, "GMT") - InStr(1, s_time, ",") - 1) str_time = Trim(str_time) a_strtime = Split(str_time, " ", -1, 1) s_month = a_strtime(1) Select Case s_month Case "Jan" s_month = "01" Case "Feb" s_month = "02" Case "Mar" s_month = "03" Case "Apr" s_month = "04" Case "May" s_month = "05" Case "Jun" s_month = "06" Case "Jul" s_month = "07" Case "Aug" s_month = "08" Case "Sep" s_month = "09" Case "Oct" s_month = "10" Case "Nov" s_month = "11" Case "Dec" s_month = "12" Case Else s_month = "01" End Select GMT_Trans = a_strtime(2) & "-" & s_month & "-" & a_strtime(0) & " " & a_strtime(3) End Function
http://zhidao.baidu.com/question/159150923.html
直接使用以下模块
Function GetUrlTime(Url As String) On Error Resume Next Set XMLHTTP = CreateObject("Microsoft.XMLHTTP") XMLHTTP.Open "HEAD", Trim(Url), False XMLHTTP.send If InStr(1, XMLHTTP.getAllResponseHeaders, "Last-Modified") = 0 Then MsgBox "获取文件的修改日期失败!", 16 GetUrlTime = "" Else GetUrlTime = GMT_Trans(XMLHTTP.getResponseHeader("Last-Modified")) End If End Function Function GMT_Trans(s_time) str_time = Mid(s_time, InStr(1, s_time, ",") + 1, InStr(1, s_time, "GMT") - InStr(1, s_time, ",") - 1) str_time = Trim(str_time) a_strtime = Split(str_time, " ", -1, 1) s_month = a_strtime(1) Select Case s_month Case "Jan" s_month = "01" Case "Feb" s_month = "02" Case "Mar" s_month = "03" Case "Apr" s_month = "04" Case "May" s_month = "05" Case "Jun" s_month = "06" Case "Jul" s_month = "07" Case "Aug" s_month = "08" Case "Sep" s_month = "09" Case "Oct" s_month = "10" Case "Nov" s_month = "11" Case "Dec" s_month = "12" Case Else s_month = "01" End Select GMT_Trans = a_strtime(2) & "-" & s_month & "-" & a_strtime(0) & " " & a_strtime(3) End Function
相关文章推荐
- VB读取文件修改时间
- nagios插件之检测文件修改时间
- Linux服务器 CentOS 6系列最小化安装优化脚本详解02————修改history记录、定时校正服务器时间、停止IPv6网络服务、调整最大文件打开数、关闭写磁盘I/O功能、配置SSH服务
- 检测文件修改时间 (awk 使用自定…
- 文件时间戳修改touch和查看stat和ls --time
- 修改文件的访问时间和修改时间为当前的时间
- stat *查看文件修改时间
- 请帮助我写个批处理 比较两个文件的修改时间 (转载)
- Linux下修改文件创建时间(修改文件更改时间)
- 修改文件创建、修改、访问时间
- 您没有权限修改该网络位置的文件
- Centos下使用find命令之查找指定时间内修改过的文件
- linux如何看一个文件夹内(包括子文件夹内)n天内修改了的文件,并且按修改时间排序(最下方是最新的)
- 批量修改字幕文件中的时间,c语言实现
- linux 获取本地文件最后修改时间 c++
- Beyond Compare怎么修改比较文件的时间戳
- Python3基础 getatime getctime getmtime 获取一个文件的最近访问时间 创建时间 最新修改时间
- touch命令:建立空文件,修改文件的时间
- linux下文件的创建时间、访问时间、修改时间和改变时间
- linux文件的三个主要的修改时间