Help required with logging and files not being posted.\

Advertisement

sharoz
Joined:
Posts:
3

Help required with logging and files not being posted.\

Hi,

i am using below code for transferring files to WinSCP. "SourcePath" are the directories,"SourcePathRecordings" are the files contained in those directories and there are almost 100 files in each directory. The issue i have been encountering is

1. sometimes the files doesn't get posted, if there are 100 files in the directory only 40-50 get posted although i have the loop on each file.
2. I want to enable WINSCP logging, and i want the log file to save on the local system. how would i do that?

Urgent help will be highly appreciated! :roll:

for (int a = 0; a < SourcePath.Length; a++)
{
string[] SourcePathRecordings = Directory.GetFiles(SourcePath[a]);
for (int i = 0; i < SourcePathRecordings.Length; i++)
{
string CommandText = "";
CommandText += @"/command ""option batch abort"" ""option confirm off"" ""Open """"" + SFTPAddress;
CommandText += @""""" -passive=on"" ""Put """"" + SourcePathRecordings[i];
CommandText += @""""" """"" + TargetPath + @"""""";
CommandText += @""" ""close"" ""exit"" ";
Process winscp = new Process();
winscp.StartInfo.FileName = @"C:\WinSCP3\WinSCP.exe"
winscp.StartInfo.Arguments = CommandText;
winscp.StartInfo.UseShellExecute = false;
winscp.StartInfo.RedirectStandardInput = true;
winscp.StartInfo.RedirectStandardOutput = true;
winscp.StartInfo.CreateNoWindow = true;
winscp.StartInfo.ErrorDialog = true;
winscp.WaitForExit();
winscp.Close();
c++;
}
}

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
29,540
Location:
Prague, Czechia

Re: Help required with logging and files not being posted.\

To enable logging, use /log=c:\path\winscp.log command-line parameter.

Though I highly recommend you to use WinSCP .NET assembly, instead of trying to run winscp.exe yourself.

Reply with quote

sharoz
Joined:
Posts:
3

i tried using the assembly too but the issue remains same if there are 75 files in my folder and i post them one by one only 10-15 files gets posted.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
29,540
Location:
Prague, Czechia

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set 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.

Reply with quote

sharoz
Joined:
Posts:
3

Martin,

i am trying to copy files over the network through winscp. I am using the assembly as per your advice. there are 100 folders on my root directory and each folder contains 100-150 files. i have attached the session log, I am getting connection time outs for all my session. Could you please help me with this?
  • winsp08.12.2016.log (25.98 KB, Private file)
Description: Session Log

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
29,540
Location:
Prague, Czechia

Sorry, I have no idea why the server keeps disconnecting you. It looks like a server-side bug.

Reply with quote

Advertisement

You can post new topics in this forum