用Onlist事件,然后分析是否存在目录呀

解决方案 »

  1.   

    Tod707070(幸福的秋天):  怎么分析? 能否详细些呢? 谢谢!
      

  2.   

    用try 
       ...
          except
       ....
        end;
    结构
      

  3.   

    定义一个全局变量
    var 
     FileNameList:Tstringlist;
    然后在空间的Onlist事件里写:
    procedure TForm1.NMFTP1ListItem(Listing: String);
     begin
       FileNameList.Add(trim(Listing));
     end;
    然后再判断文件或目录是否存在于FileNameList中就可以了!
    如:
     if FileNameLIst.indexof(YourName)<=0 then 
        不存在!
      

  4.   

    或者:
      try//若改变错误则正常出发异常.
        NMFTP1.ChangeDir(YourDirName);
      except
        Raise Exception.create('目录不存在!');
      end;