I have an app that creates batch files for an ftp process and uses the absolute path as the download location. This creates an error when executed because the path has whitespaces included. Any help is appreciated.
Code follows:
using
(StreamWriter sw = TextFile.CreateText())
{
sw.WriteLine("open " + ftpIpAddress);
sw.WriteLine("user");
sw.WriteLine(ftpLogin);
sw.WriteLine(ftpPassword);
sw.WriteLine("lcd " + DirInfo.FullName);
sw.WriteLine("mget pVQI" + date.ToString("MMdd") + "*.zip");
sw.WriteLine("pause");
sw.WriteLine("quit");
sw.Close();
}
ProcessStartInfo
psi = new ProcessStartInfo(BatFile.FullName);
psi.RedirectStandardOutput = false;
psi.WindowStyle = ProcessWindowStyle.Minimized;
psi.UseShellExecute = false;
Process ftp = Process.Start(psi);
StreamReader output = ftp.StandardOutput;
ftp.WaitForExit();
if (ftp.HasExited)
{
rtbOutput.AppendText("FTP process ended.\n");
string line;
while (!output.EndOfStream)
{
line = output.ReadLine();
rtbOutput.AppendText(line + "\n");
}
These are just snippets, fyi.