Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Automating WinSCP from console app
Message
From
21/11/2019 11:20:46
 
 
To
21/11/2019 10:58:36
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01671974
Message ID:
01671975
Views:
29
Nevermind, finally found the issue - it was in the building of the UploadDirectory. Sorry to waste your time reading all this



>Anyone have any experience automating WinSCP from a console app?
>
>My app downloads files from one FTP server (no problem here), does some processing on the files and then (should) upload the resulting files to another FTP server.
>
>The upload is failing with "Error transferring file 'c:\blahblahblah' Copying files to remote side failed. Access is denied."
>
>I can attach to the FTP server using the same userid/pw the app is using and manually upload one of the files, but not programatically.
>
>These file should not already exist on the server, with testing and such they might, but production - no.
>
>The code I'm using:
>
>      using (Session session = new Session())
>      {
>        // Connect
>        session.Open(sessionOptions);
>
>        // Transfer files
>        // **Note:  File structure that the file is coming from has the '\'.
>        //          File structure that the file is going to has the '/'.
>
>        //Set up TransferOptions 
>        TransferOptions tOpt = new TransferOptions();
>        tOpt.OverwriteMode = OverwriteMode.Overwrite;
>        tOpt.AddRawSettings("NewerOnly", "1");
>        tOpt.PreserveTimestamp = false;
>        try
>        {
>          session.PutFiles(UpldFile, UpldDir, false, tOpt).Check();
>          LogFTP(Path.GetFileName(UpldFile), "Up");
>        }
>        catch (Exception e)
>        {
>          Console.WriteLine("Error: {0}", e);
>          Console.ReadLine();
>        }
>
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Previous
Reply
Map
View

Click here to load this message in the networking platform