Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: posting files

Sorry, but I do not see any problem described in your post.
gummadi.ram@gmail.com

posting files

Hi
i am having a problem to put files into sftp when runnning on server
but if use in debug mode
the files are copying
but the logs i put it saying the files are copied and after copying i am also checking what i copied
and am getting response
Process ASN Backstamp @ 2020/11/07 10:46:23 AM

no of files found2 @ 2020/11/07 10:46:23 AM
externorderkey--> 3257232014 @ 2020/11/07 10:46:24 AM
file createdD:\\FFS\\Backstamp\\ASNBackStamp\\RECADV_3257232014.txt @ 2020/11/07 10:46:24 AM
updated transmitflag @ 2020/11/07 10:46:24 AM
Upload of D:\FFS\Backstamp\ASNBackStamp\RECADV_3257232014.txt succeeded and copied to inbound
files found-->2
RECADV_3257232014.txt with size 392, permissions rw-rw-rw- and last modification at 2020/11/07 10:46:31 AM
.. with size 0, permissions  and last modification at 0001/01/01 12:00:00 AM
file copied to sftp--> D:\\FFS\\Backstamp\\ASNBackStamp\\RECADV_3257232014.txtto folder-->inbound @ 2020/11/07 10:46:33 AM
externorderkey--> 3257232015 @ 2020/11/07 10:46:33 AM
file createdD:\\FFS\\Backstamp\\ASNBackStamp\\RECADV_3257232015.txt @ 2020/11/07 10:46:33 AM
updated transmitflag @ 2020/11/07 10:46:34 AM
Upload of D:\FFS\Backstamp\ASNBackStamp\RECADV_3257232015.txt succeeded and copied to inbound
files found-->2
RECADV_3257232015.txt with size 392, permissions rw-rw-rw- and last modification at 2020/11/07 10:46:40 AM
.. with size 0, permissions  and last modification at 0001/01/01 12:00:00 AM
file copied to sftp--> D:\\FFS\\Backstamp\\ASNBackStamp\\RECADV_3257232015.txtto folder-->inbound @ 2020/11/07 10:46:42 AM

and here the code i am using
please let me know
i am using vs2015 and winscp 5.17.7
try
{
    // Setup session options
    SessionOptions sessionOptions = new SessionOptions
    {
        Protocol = Protocol.Sftp,
        HostName = sftphost,
        UserName = sftpuser,
        Password = sftppwd,
        SshHostKeyFingerprint = sftpfingerprint
    };
    Console.WriteLine("i am here to connect to sftp and fetch files ");
    using (Session session = new Session())
    {
        // Connect
        session.Open(sessionOptions);                                   
        // Upload files
        TransferOptions transferOptions = new TransferOptions();
        transferOptions.TransferMode = TransferMode.Binary;
 
        TransferEventArgs tea = session.PutFileToDirectory(filenameSO, "/inbound/", false, transferOptions);
        Console.WriteLine("Upload of {0} succeeded and copied to {1}", tea.FileName, tea.Destination);
        WriteLog(filename , String .Format("Upload of {0} succeeded and copied to {1}" , tea .FileName , tea .Destination , DateTime .Now));
        WriteLog(filename, String.Format("{0} @ {1}", "file copied to sftp--> "+ filenameSO+"to folder-->inbound", DateTime.Now));
 
        WriteLog(filename , String .Format("Upload of {0} succeeded and copied to {1}" , tea .FileName , "inbound" , DateTime .Now));
 
        RemoteDirectoryInfo directory = session.ListDirectory("/inbound/");
        WriteLog(filename , String .Format("files found-->"+directory .Files .Count .ToString() , DateTime .Now));
        foreach ( RemoteFileInfo fileInfo in directory .Files )
        {
            WriteLog(filename , String .Format("{0} with size {1}, permissions {2} and last modification at {3}",
                fileInfo .Name , fileInfo .Length , fileInfo .FilePermissions ,
                fileInfo .LastWriteTime , DateTime .Now));
            Console .WriteLine(
                "{0} with size {1}, permissions {2} and last modification at {3}" ,
                fileInfo .Name , fileInfo .Length , fileInfo .FilePermissions ,
                fileInfo .LastWriteTime);
        }
    }
}
catch (Exception e)
{
    WriteLog(filename, String.Format("{0} @ {1}", "file failed copied to sftp" + e.Message.ToString(), DateTime.Now));
    Console.WriteLine("Error: {0}", e);
    Console.Read();
}

if possible please