要求是使用vbscript获取今天在特定文件夹中的unix ftp服务器中创建/修改的文件名列表。那有可能吗?我是VBScript的新手。请帮我。我不能使用任何外部软件等。
Set objFSO1 = CreateObject("Scripting.FileSystemObject")
Set objwrc = objFSO1.CreateTextFile("c:\Jobs.txt", True)
objwrc.WriteLine "open ipadress"
objwrc.WriteLine "username"
objwrc.WriteLine "password"
objwrc.WriteLine "cd foldername"
objwrc.WriteLine "dir . print.txt"
objwrc.WriteLine "quit"
Set objShell = CreateObject("WScript.Shell")
objShell.Run "%comspec% /c c:\windows\system32\ftp.exe -s:c:\Jobs.txt ",,true
Msgbox("Done")
答案 0 :(得分:0)
我会创建一个这样的脚本,名为ftp.script
:
open a.b.c.d
user username password
dir
quit
其中a.b.c.d是您的FTP服务器的IP地址或名称。
然后你需要执行一个执行此操作的过程:
ftp -n -s:ftp.script
并解析输出。
如果要解析输出,可以执行以下操作:
output=split(createobject("wscript.Shell").exec("cmd /c DIR ").stdout.readall,vbCrLf)
for i=0 to ubound(output)
msgbox output(i)
next
但更改命令以执行FTP脚本。
您可能需要注意"今天"的定义。因为服务器可能与你处于不同的时区......