下面是部分程序,要如何更改才能实现呢?(我的modem已调好)
while(true)
{
try
{
//航危报报文文件目录
DirectoryInfo dir_fb = new DirectoryInfo("d:\\hnny");
FileInfo[] file_fb = dir_fb.GetFiles("*.*"); int i;
string file_name="";
bool check_time1;
FileInfo file_info;
System.DateTime  ft1,ft2;
for(i=0;i<file_fb.Length;i++)
{
file_name=file_fb[i].ToString();
//MessageBox.Show(file_name);
if(System.IO.File.Exists("d:\\hnny1\\"+file_fb[i])==false)  //文件不存在
{
System.IO.File.Copy("d:\\hnny" + "\\" + file_fb[i], "d:\\hnny1\\"+ file_fb[i],true);
FTPFactory ff = new FTPFactory();
ff.setDebug(true);
ff.setRemoteHost("172.22.68.4");
ff.setRemoteUser("webipp");
ff.setRemotePass("");
ff.login();
ff.chdir("bt\\hnny");
ff.upload("d:\\hnny\\"+file_name);
ff.close();
}
else
{
//比较文件大小和时间
ft1=System.IO.File.GetLastWriteTime("d:\\hnny\\"+file_fb[i].Name);
ft2=System.IO.File.GetLastWriteTime("d:\\hnny1\\"+file_fb[i].Name);
check_time1=System.DateTime.Equals(ft1,ft2);
file_info=new FileInfo("d:\\hnny1\\"+file_name);
//MessageBox.Show(file_name+"  "+check_time1.ToString()+"  "+check_time2.ToString()); 
if(check_time1==true && file_fb[i].Length==file_info.Length) continue;
else if(check_time1==false && file_fb[i].Length==file_info.Length) 
{
System.IO.File.Copy("d:\\hnny" + "\\" + file_fb[i], "d:\\hnny1\\"+ file_fb[i],true);
FTPFactory ff = new FTPFactory();
ff.setDebug(true);
ff.setRemoteHost("172.22.68.4");
ff.setRemoteUser("webipp");
ff.setRemotePass("");
ff.login();
ff.chdir("bt\\hnny");
ff.upload("d:\\hnny\\"+file_name);
ff.close();
}
else if(check_time1==false && file_fb[i].Length!=file_info.Length)
{
System.IO.File.Copy("d:\\hnny" + "\\" + file_fb[i], "d:\\hnny1\\"+ file_fb[i],true);
FTPFactory ff = new FTPFactory();
ff.setDebug(true);
ff.setRemoteHost("172.22.68.4");
ff.setRemoteUser("webipp");
ff.setRemotePass("");
ff.login();
ff.chdir("bt\\hnny");
ff.upload("d:\\hnny\\"+file_name);
ff.close();
}