使用批处理文件从sFtp服务器下载excel文件

时间:2016-05-24 19:21:32

标签: excel vba batch-file sftp

我正在寻找像ftp for sftp这样的代码,可以用来连接服务器,从给定的路径下载请求的文件。

这可以使用批处理文件或excel宏来完成,无论如何,我们都会感激。

我不能使用任何客户端来完成这项工作,它必须是一个批处理文件或宏来完成工作。

编辑:

批代码

open your.ftpserver.com
user yourUsername yourPassword
lcd C:\Downloads
cd yourRemoteFolder
binary
get "East Vat Account.xlsx"
bye

运行批处理文件的宏

Public Sub Ftp_Download_File()

    Dim FTPcommand As String
    Dim wsh As Object

    FTPcommand = "ftp -n -s:" & Chr(34) & "C:\FTP_commands.txt" & Chr(34)
    Set wsh = CreateObject("WScript.Shell")
    wsh.Run FTPcommand, 5, True

    Workbooks.Open "C:\Downloads\East Vat Account.xlsx"

End Sub

0 个答案:

没有答案