Hi All,
I am trying to automate my WinSCP script to download files from an FTP server from Access VBA
This is my WinSCP code and text file
Private Sub Command1_Click()
Dim strQuote As String
strQuote = Chr(34)
Dim strSFTPDir As String
strSFTPDir = "C:\Program Files (x86)\Winscp\"
Dim strCommand As String
strCommand = "/script=C:\Daily\inputs\dtccwinscpfile.txt"
Call Shell(strSFTPDir & "winscp.exe " & strQuote & strCommand & strQuote, vbNormalNoFocus)
End Sub
This is my script text file
open 10.xxx.x.xx
2852
pwd3478!#
cd ftphome
lcd DeliveryOrders
mget *.ftprcv \\10.xxx.xx.xx\backupshare\205\Reports\DTCC\dtcc\*.txt
quit
It is not retrieving any files. Is the WinSCP command script correct?
The
mget
downloads the files which are in FTPRCV type and saves it as .txt
What am I doing wrong?
When I use winscp manually from GUI, I am able to get these files.
In our organization, they have a version of WinSCP on which the Generate code and other features are disabled :(
Also, how do I direct the code to a log file?
TIA