检测文件路径是用FileExists那如何批量进行检测呢假如现在有个listbox,每行都是文件的路径要实现的功能:
 文件都存在showmessage('1')
 只要有一个文件不存在就showmessage('2')
要具体代码~~

解决方案 »

  1.   

    循环list,对每个item调用FileExists
      

  2.   


    这我知道,可是写出来有问题var
    i:integer;begin
      for i:=0 to listbox1.Items.Count-1 do
       if Fileexists(Trim(listbox1.Items[i])) then
         showmessage('1')
       else
         showmessage('2');
    end;
    listbox里有几行,showmessage('1')就执行了几遍
    我想让showmessage只执行一次
      

  3.   

    var
    i:integer;
    IsExists :boolean;
    begin
      IsExists := False;
      for i:=0 to listbox1.Items.Count-1 do
        if Fileexists(Trim(listbox1.Items[i])) then
          IsExists := True
        else begin
          IsExists := False;
          Break;
        end;
      if IsExists then
         showmessage('1')
      else
         showmessage('2');
    end;