Re: Scheduled task using winscp
Out of interest what char should I have used when there is a space in the path?
See
https://winscp.net/eng/docs/commandline#syntax
https://winscp.net/eng/docs/scripting#syntax
Out of interest what char should I have used when there is a space in the path?
. 2014-02-13 14:35:00.887 File: "G:\Division\RAD\netTestUpload\waitlistweek.xml"
* 2014-02-13 14:35:00.887 (EOSError) System Error. Code: 3.
* 2014-02-13 14:35:00.903 The system cannot find the path specified
. 2014-02-13 14:35:00.903 Asking user:
. 2014-02-13 14:35:00.919 File or folder 'G:\Division\RAD\netTestUpload\waitlistweek.xml' does not exist. ("System Error. Code: 3.
. 2014-02-13 14:35:00.919 The system cannot find the path specified")
Please give us some context.
. 2014-02-13 14:35:00.887 File: "G:\Division\RAD\netTestUpload\waitlistweek.xml"
* 2014-02-13 14:35:00.887 (EOSError) System Error. Code: 3.
* 2014-02-13 14:35:00.903 The system cannot find the path specified
. 2014-02-13 14:35:00.903 Asking user:
. 2014-02-13 14:35:00.919 File or folder 'G:\Division\RAD\netTestUpload\waitlistweek.xml' does not exist. ("System Error. Code: 3.
. 2014-02-13 14:35:00.919 The system cannot find the path specified")
Thx for the reply. Registering produced;
C:\>C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe WinSCPnet.dll /codebase /tlb
RegAsm : error RA0000 : Unable to locate input assembly 'WinSCPnet.dll' or one of its dependencies.
'WinSCPnet.dll' is the the directory C:\Program Files\WinSCP
RegAsm.exe
does not/cannot scan whole hard disk to look for the assembly. You need to give it full path to the .dll
:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe "C:\Program Files\WinSCP\WinSCPnet.dll" /codebase /tlb
Apologies for lack of clarity. When trying to select the Reference-VBAProject what is the precise name of reference as I do not see anything like WinSCP . Have I failed to install correctly
Have reverted to scheduled tasks as suggested by prikryl.
"C:\Program Files\WinSCP\WinSCP.exe" /command "option batch abort" "option confirm off" "open sftp://xxx:xxx@xxx.xxx.xx.xx" "put C:\waitlistweek.xml /var/www/dashboard/" "exit" /log
This appears not to be working.
What does it mean "This appears not to be working"?
/log=path_to_log
switch and inspect the log. Or attach it here.
Tried to reference 'the WinSCP console interface .NET wrapper' after the suggested install but could not find the reference. ??
That does it mean "but could not find the reference"?
Have reverted to scheduled tasks as suggested by prikryl.
"C:\Program Files\WinSCP\WinSCP.exe" /command "option batch abort" "option confirm off" "open sftp://xxx:xxx@xxx.xxx.xx.xx" "put C:\waitlistweek.xml /var/www/dashboard/" "exit" /log
This appears not to be working.
What does it mean "This appears not to be working"?
Tried to reference 'the WinSCP console interface .NET wrapper' after the suggested install but could not find the reference. ??
Have reverted to scheduled tasks as suggested by prikryl.
"C:\Program Files\WinSCP\WinSCP.exe" /command "option batch abort" "option confirm off" "open sftp://xxx:xxx@xxx.xxx.xx.xx" "put C:\waitlistweek.xml /var/www/dashboard/" "exit" /log
This appears not to be working.
Sub Macro1()
'
' Setup session options
Dim mySessionOptions As New SessionOptions
With mySessionOptions
.Protocol = Protocol_Sftp
.HostName = "****"
.UserName = "****"
.Password = "****"
End With
' Connect
mySession.Open mySessionOptions
' Upload files
Dim myTransferOptions As New TransferOptions
myTransferOptions.TransferMode = TransferMode_Binary
Dim transferResult As TransferOperationResult
Set transferResult = mySession.PutFiles("C:\Directory and filename was here", False, myTransferOptions)
' Throw on any error
transferResult.Check
' Display results
Dim transfer As TransferEventArgs
For Each transfer In transferResult.Transfers
MsgBox "Upload of " & transfer.Filename & " succeeded"
Next
End Sub
ftp
with WinSCP, you probably do not need the WinSCP .NET assembly. Just use WinSCP scripting interface the same way you were using the ftp
.