BAT 调用 VBS 通过curl 检查FTP中的文件日期
2010-12-16 16:35
591 查看
VBS调用curl 检查FTP中的文件日期,传入一个日期参数,然后ftp某个目录中的所有文件和这个日期进行比较.返回大于传入日期参数的个数.
Set objArgs = WScript.Arguments
strTmp=now
If objArgs.Count>0 Then
strTmp= objArgs(0)
End If
If Len(strTmp)=0 or objArgs.Count=0 Then
strTmp=trim(inputbox("Entry Date","Date",strTmp ))
End If
If Len(strTmp)>0 Then
strTmp=CDate(left(CDate(strTmp),11))
'msgbox strTmp
Set objShell = CreateObject("Wscript.Shell")
SET A = objShell.exec("curl.exe ""ftp://xxxxxxx/"" -X ""list -al"" -u username:password").stdout
b = A.readall
tmpLine= split(b,vbcrlf)
iFileCount=0
for i=0 to UBound(tmpLine)
'读取文件列表中的每一行
if Len(tmpLine(i))>0 And instr(tmpLine(i)," <DIR>")<=0 then
tmpstr=CDate(Trim(left(tmpLine(i),25)))
'日期比较
If tmpstr>strTmp Then
'计数
iFileCount=iFileCount+1
End If
'msgbox tmpstr
End if
Next
'返回计数值
'MsgBox iFileCount
WScript.Quit(iFileCount)
end if
下面的bat 调用
echo off
ChkFTPFile.vbs %date%
'如果ftp上的文件日期大于当天的文件总数为11
if ERRORLEVEL 11 run some commad
Set objArgs = WScript.Arguments
strTmp=now
If objArgs.Count>0 Then
strTmp= objArgs(0)
End If
If Len(strTmp)=0 or objArgs.Count=0 Then
strTmp=trim(inputbox("Entry Date","Date",strTmp ))
End If
If Len(strTmp)>0 Then
strTmp=CDate(left(CDate(strTmp),11))
'msgbox strTmp
Set objShell = CreateObject("Wscript.Shell")
SET A = objShell.exec("curl.exe ""ftp://xxxxxxx/"" -X ""list -al"" -u username:password").stdout
b = A.readall
tmpLine= split(b,vbcrlf)
iFileCount=0
for i=0 to UBound(tmpLine)
'读取文件列表中的每一行
if Len(tmpLine(i))>0 And instr(tmpLine(i)," <DIR>")<=0 then
tmpstr=CDate(Trim(left(tmpLine(i),25)))
'日期比较
If tmpstr>strTmp Then
'计数
iFileCount=iFileCount+1
End If
'msgbox tmpstr
End if
Next
'返回计数值
'MsgBox iFileCount
WScript.Quit(iFileCount)
end if
下面的bat 调用
echo off
ChkFTPFile.vbs %date%
'如果ftp上的文件日期大于当天的文件总数为11
if ERRORLEVEL 11 run some commad
相关文章推荐
- 【VBscript Shell】通过vbs文件调用bat文件达到隐藏cmd窗口后台运行的效果
- vbs 批量修改文件,bat 批处理文件调用执行vbs,并在cmd窗口打印返回值(vbs运行结果)
- vbs 批量修改文件,bat 批处理文件调用执行vbs,并在cmd窗口打印返回值(vbs运行结果)
- 利用sql语句调用bat(批处理)+ftp实现文件远程拷贝和注入
- 通过批处理调用FTP自动下载文件
- C# 通过bat文件来调用jar文件运行客户端出错
- Windows下通过bat批处理文件和vbs脚本实现守护进程
- 从ftp定时下载按日期生成的文件[windows bat]
- [SoapUI] 通过Groovy调用批处理文件.bat
- [Jmeter]通过批处理调用java,java从CSV动态读取登录的用户名和密码,并将其作为参数组合成字符串,写入外部.bat文件,然后通过Java执行这个外部批处理文件
- 【开源自动化测试疑难FAQ】【框架】EXE/VBS/BAT/SHELL等文件的调用安全守护
- bat脚本使本地通过ftp和服务器传输文件
- 通过 api 调用检查具体日期是否为法定节假日
- 在Salesforce中通过编写C#程序调用dataloadercliq的bat文件取触发调用data loader来批量处理数据
- window下批处理操作:bat文件中调用vbs
- Windows下通过bat脚本实现自动上传文件到ftp服务器
- 通过批处理调用FTP自动下载文件
- 通过 api 调用检查具体日期是否为法定节假日
- 通过ftp发送检测文件,存放在FTP服务器中
- 首先检查这个xx类文件是否存在,并调用这个类的构造函数