@AndresGomez: And does it work in any other SFTP client for you? For example in the command-line OpenSSH
sftp
? Show us.
sftp
? Show us.
Error listing directory '/+lrecl=35'.
The file path does not exist or is invalid.
// Setup session options
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = "10.0.0.7",
PortNumber = 2222,
UserName = "user",
Password = "password",
SshHostKeyFingerprint = "ssh-rsa 2048 JEdoyPd09IwNgLHT6mnRJunJwO6GihiHhrTgq0TXrks"
};
using (Session session = new Session())
{
// Connect
session.Open(sessionOptions);
// Upload files
TransferOptions transferOptions = new TransferOptions
{ TransferMode = TransferMode.Automatic, };
session.ListDirectory("/+lrecl=35");
session.PutFiles(@"C:\Temp\LOTE1808.035", "/public/test2/", false, transferOptions).Check();
}
session.ListDirectory("/+recfm=fb,lrecl=2214,blksize=0,replace/");
/replace
in session.ListDirectory()
.
Session.SessionLogPath
. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.And also, even after error, it is creating file on server but with no data.Cannot overwrite remote file "FineName".$$
Press 'Delete' to delete the file and create new one instead of overwriting it.$$
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = "ServeName",
UserName = "Userid",
SshHostKeyFingerprint = "------------",
SshPrivateKeyPath = @"----------------",
};
sessionOptions.AddRawSettings("FSProtocol", "2");
sessionOptions.AddRawSettings("CacheDirectories", "0");
sessionOptions.AddRawSettings("CacheDirectoryChanges", "0");
using (Session session = new Session())
{
session.Open(sessionOptions);
TransferOptions transferOptions = new TransferOptions
{ TransferMode = TransferMode.Automatic, };
session.ListDirectory("/+lrecl=35");
session.ListDirectory("/+RECFM=FB");
session.PutFiles(sourcepath, cpedFilename, false, transferOptions).Check();
}
session.ListDirectory("/+lrecl=35");
session.ListDirectory("/+RECFM=FB");
session.ListDirectory("/+lrecl=255")
sftp> ls /+lrecl=255
session.put()
record length is same. But when I am using SFTP protocol, my line is breaking at 100 length and going to next line. Not sure if I have to set any attribute?