Error uploading files to Remote Directory

Advertisement

rajeshlhegde
Joined:
Posts:
1
Location:
USA

Error uploading files to Remote Directory

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);

}


}

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,317
Location:
Prague, Czechia

Re: Error uploading files to Remote Directory

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).

Reply with quote

Advertisement

You can post new topics in this forum