如果不使用FTP方式,则可以参照以下代码实现上传与下载文件
private void Upload_Net()
{
string SPATH = @"\\10.193.241.17\ccib";
try
{
Directory.GetFiles(SPATH);
}
catch
{
Process process = new Process();
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = true;
process.Start();
process.StandardInput.WriteLine("net use " + SPATH + " /delete");
process.StandardInput.WriteLine("net use " + SPATH + " foxconn@2008 /USER:ccib");
process.StandardInput.WriteLine("exit");
Directory.GetFiles(SPATH);
}
if(File.Exists(@"D:\CCIB\CCIB.mdb"))
{
File.Delete(@"D:\CCIB\CCIB.mdb");
}
File.Copy(@"D:\YT_CCIB\CCIB.mdb", SPATH + @"\CCIB.mdb");
}
酱油。