English 中文(简体)
SFTP 传输文件并移动文件到文件夹
原标题:SFTP transfer file and move file to folder
问题回答
This will move a file to the specified location. Sub Move_File(Source_File, Destination_Folder) Dim fso Set fso = CreateObject("Scripting.FileSystemObject") fso.MoveFile Source_File, Destination_Folder Set fso = Nothing End Sub
sftp client provides a means to change working directory on the host before performing any file transfers. It would be better to thus transfer the file directly to the target location. NOTE: The above answer was a result of misunderstanding the question. I read it to mean the file had to be moved on the destination but the real operation was to move the file on the origin. I found the following example code that moves a file after checking that it exists. Wildcards are allowed for the source parameter but then FileExists may not work. Requires vbscript 2.0 to work. <% dim filesys set filesys=CreateObject("Scripting.FileSystemObject") If filesys.FileExists("c:sourcefolderanyfile.html") Then filesys.MoveFile "c:sourcefolderanyfile.html", "c:destfolder" End If %>




相关问题
What approach should I use to test a VBScript?

I ve been asked to help out with a project which has made extensive use of VBScript to process a whole bunch of text files and generate certain outputs - sanitized files, SQL entries etc.. The script ...

Unable to call c# code from vbscript - ActiveX error

I am trying to call a method I have written in C# from VBScript. I have followed just about all of the instructions I can find on the web and am still having problems. Specifically I am getting Error:...

How to set delay in vbscript

How to set delay in vbscript? WScript.Sleep(100) does not work on Windows XP, Vista.

Using Classes in a Dictionary in Classic ASP

I usually do C# but have inherited a classic ASP project. I have defined a class: Class clsPayment Public Name End Class Set objPayment = New clsPayment objPayment.Name = "...

How to check which Operating System?

How can I check OS version in a batch file or through a vbs in an Windows 2k/2k3 environment ? You know ... Something like ... : "If winver Win2k then ... or if winver Win2k3 then ....

Problem casting field when querying spreadsheet

I am trying to query an .xls spreadsheet with VBScript, but I have run into an issue when trying to cast a field. I connect to the spreadsheet like this. Set objConnection = CreateObject("ADODB....

热门标签