Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
C# app ftp process whitespace problem
Jonathan Ownbey
Jun 20 2007 10:08 PM
1.9k
Reply
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.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Help! Error " you are trying to read or write into protected memory"
validate Integers.....