Cannot create remote file- Permission denied

Advertisement

Guest

Cannot create remote file- Permission denied

I am using WinSCP Version 5.11.2 (Build 7781)
OS is Windows 7 Enterprise- (OS 6.1.7601 Service Pack 1)

I am trying to upload 1 file to a subdirectory.
I am able to do this using the WinScp client tool.

however, when I try to put it in a code (VB6) I am getting a "cannot create remote file" "permission denied" error.

I have tried multiple variations of remote file path,s transferOptions.FilePermissions , and transferOptions.FileMask = "*.*" to no avail.

Also, as I said, manually transferring the file works fine, so it is not a permissions problem.

I have generated a log of the manual transfer, but I don't see what I am missing (a side issue is, the log shows WinScp is listing all of the files in the subfolder, and it takes some time to do this, why is it reading all the files in the subfolder?? can it just put the file in there?).


The code is:

Dim session As WinSCPnet.session
Dim sessionOptions As WinSCPnet.sessionOptions
Dim transferOptions As WinSCPnet.transferOptions
Dim transferResult As TransferOperationResult

Dim longFilenameLocal As String
Dim remoteFilePath As String

remoteFilePath = "/app_home/GL.INTERFACES/CSTEST2.TXT"

longFilenameLocal = "C:\local\datatel\RSCApps\BudgetModule\app\data\CSTEST2.TXT"



Set session = New WinSCPnet.session
Set transferOptions = New transferOptions

Set sessionOptions = New WinSCPnet.sessionOptions
sessionOptions.Protocol = Protocol_Sftp

sessionOptions.HostName = "colapp1-prod.cloud.rsccd.edu"
sessionOptions.username = "svc_FileProcessing"
sessionOptions.Password = "L2)uUYZ!MSf2"

sessionOptions.SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx.."

' Connect
session.Open sessionOptions

' Upload file
transferOptions.TransferMode = TransferMode_Binary

transferOptions.PreserveTimestamp = False

Set transferResult = session.PutFiles(longFilenameLocal, remoteFilePath, False, transferOptions)

' Throw on any error
transferResult.Check

Reply with quote

Advertisement

Guest

Just found the problem: the path to the remote file had a typo!
Found it by looking at the log, it said: "no such file".

Reply with quote

Advertisement

You can post new topics in this forum