Steps to transfer file from one loc to other
1)Mention the path,user credentials like
string s += "192.168.0.61" + " ";
s += "-l " + "XYZ" + " ";
s += "-pw " + "XYZ" + " ";
where
- l-login
-pw-password
System.Diagnostics.ProcessStartInfo startinfo = new System.Diagnostics.ProcessStartInfo();
startinfo.CreateNoWindow = false;
startinfo.UseShellExecute = false;
startinfo.FileName = Server.MapPath("~/Pres/psftp.exe");
startinfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startinfo.Arguments = textfile;
startinfo.RedirectStandardInput = true;
startinfo.RedirectStandardOutput = true;
Process p = Process.Start(startinfo);
p.StandardInput.WriteLine("cd foldername");
FileInfo[] files = new DirectoryInfo(Server.MapPath("~//Bach/")).GetFiles("*.txt", SearchOption.TopDirectoryOnly);
foreach (FileInfo tfile in files)
{
fileFullName = tfile.FullName;
filename = Path.GetFileNameWithoutExtension(tfile.Name);
list.Add(filename);
p.StandardInput.WriteLine("mput " + fileFullName);
}
p.StandardInput.WriteLine("quit");