VBscript,在FTP中创建目录
我想在 FTP 中创建一个目录,目录的名称必须是我的计算机名称,
这是我的代码,
Dim FoldertoCreate, filesys, newfolder, Ob
Set Ob = Wscript.CreateObject("Wscript.Network" )
FoldertoCreate = "ftp://user:password@ftpserver/url-path/" & ob.ComputerName
Set filesys = CreateObject("Scripting.FileSystemObject")
If Not filesys.FolderExists(FoldertoCreate) Then
Set newfolder = filesys.CreateFolder(FoldertoCreate)
End If
但是当我替换 ftp://user:password@ftpserver/url-path 与任何本地目录(如 D:/ ),它的工作原理:S
如何使其适用于我的 ftp也
I would like to create a directory in FTP, the name of the directory must be as my computer name,
here is my code,
Dim FoldertoCreate, filesys, newfolder, Ob
Set Ob = Wscript.CreateObject("Wscript.Network" )
FoldertoCreate = "ftp://user:password@ftpserver/url-path/" & ob.ComputerName
Set filesys = CreateObject("Scripting.FileSystemObject")
If Not filesys.FolderExists(FoldertoCreate) Then
Set newfolder = filesys.CreateFolder(FoldertoCreate)
End If
This code doesn't work however when i replace ftp://user:password@ftpserver/url-path with any local directory like D:/ , it works :S
how to make it work for my ftp too
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
FileSystemObject 不支持 FTP。 Shell 自动化对象可以,但它似乎不喜欢 NewFolder 方法。这样我们就可以使用无人值守的 FTP 会话来自动执行 FTP.exe 命令。它可能看起来像这样。
The FileSystemObject does not support FTP. The Shell Automation Object does, but it doesn't seem to like the NewFolder method. That leaves us with automating the FTP.exe command using an unattended FTP session. It might look something like this.