Topic "Error uploading files to Remote Directory"

Author Message
rajeshlhegde
[View user's profile]

Joined: 2014-09-23
Posts: 1
Location: USA
Hi,
I am trying files to remote directory. The source folder is "Data" (relative to current directory) and the destination is \rcmprod\.

I have attached the log for the session.

here is the code iam using:

// Setup session options
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Convert.ToBoolean(ConfigurationManager.AppSettings["UseSFTP"]) ? Protocol.Sftp : Protocol.Ftp, //If SFTP is configured then use that or else use FTP ; in PROD it should be SFTP
HostName = ConfigurationManager.AppSettings["SFTPHost"],
UserName = ConfigurationManager.AppSettings["SFTPUserName"],
Password = ConfigurationManager.AppSettings["SFTPPassword"],
SshHostKeyFingerprint = Convert.ToBoolean(ConfigurationManager.AppSettings["UseSFTP"]) ? ConfigurationManager.AppSettings["SFTPHostKey"] : null
};

using (Session session = new Session())
{

session.SessionLogPath = GetSessionLogPath();
// Connect
session.Open(sessionOptions);

// Upload files
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;

TransferOperationResult transferResult;
transferResult = session.PutFiles(ConfigurationManager.AppSettings["SFTPSourceFolder"], ConfigurationManager.AppSettings["SFTPRemoteFolder"], false, transferOptions);
//rcmtest is the remote folder at the root level

// Throw on any error
transferResult.Check();

// Print results and Archive data file
foreach (TransferEventArgs transfer in transferResult.Transfers)
{

NLog.LogManager.GetCurrentClassLogger().Trace("Upload of {0} succeeded", transfer.FileName);

ArchiveData(transfer.FileName);

}


}
sftp.txt (5.04 KB) [Download]

Description: (none)

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Well, startup path is /opt/ftpguests/rcmprod, so I assume you should upload the files to /opt/ftpguests/rcmprod/, not /rcmprod/. The /rcmprod/ does not exist and cannot be created (I assume you do not have permissions to create directories is a root).
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License