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++;
}
}
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++;
}
}