======wish this help======
1.  在返回的时间中,如果返回没有年份,就是说明此文件是当
天存的,年份应该与你的机器是一样的。
2.  将字符的月份转化成数值
3.  分割由空格分开的字符串
4.  如何判断是目录还是文件,就是第一个字母为'd'就是目录。
其它我认为是文件。
5.  忽略当然目录和父目录,以及'total'字符串在这里只处理了文件与目录,用户与组别不考虑(似乎用不上)
日期我用了字符串表示,'yyyy/mm/dd'    TFileAttr=(faDir,fafile);
    PTFileInfo=^TFileInfo;
    TFileInfo=record
        FAttr:TFileAttr;
        FLen:integer;
        FFileName:string;
        FDate:string;
    end;函数如下:
procedure SetListString(var n:TFileInfo;s:string);
var
    tempstr,ps:string;    function getsubstr(var s:string):string;
    var
        k,l:integer;
    begin
        l:=length(s);
        for k:=1 to l do
            if s[k]<>' ' then break;
        s:=copy(s,k,l-k+1);
        l:=length(s);
        for k:=1 to l do
        begin
            if s[k]=' ' then break;
        end;
        result:=copy(s,1,k-1);
        s:=copy(s,k+1,l-k);
    end;
begin
    tempstr:=s;
    with n do
    begin
        ps:=getsubstr(tempstr);
        if ps='total' then exit;
        if ps[1]='d' then FAttr:=faDir  //目录
        else Fattr:=fafile;  //文件        ps:=getsubstr(tempstr);
        ps:=getsubstr(tempstr);
        ps:=getsubstr(tempstr);
        FLen:=strtoint(getsubstr(tempstr));
        FDate:=formatdatetime('yyyy',date);
        ps:=getsubstr(tempstr);
        FDate:=changemonth(ps);
        ps:=getsubstr(tempstr);
        FDate:=FDate+'/'+ps;
        ps:=getsubstr(tempstr);
        if pos(':',ps)>0 then
            FDate:=formatdatetime('yyyy',date)+'/'+FDate
        else
            FDate:=ps+'/'+FDate;
        FFileName:=getsubstr(tempstr);
    end;
end;//转换月份
function ChangeMonth(month:string):string;
begin
    result:='';
    month:=uppercase(month);
    if month='JAN' then result:='01'
    else if month='FEB' then result:='02'
    else if month='MAR' then result:='03'
    else if month='APR' then result:='04'
    else if month='MAY' then result:='05'
    else if month='JUN' then result:='06'
    else if month='JUL' then result:='07'
    else if month='AUG' then result:='08'
    else if month='FEB' then result:='09'
    else if month='OCT' then result:='10'
    else if month='NOV' then result:='11'
    else if month='DEC' then result:='12';
end;
//在ftplistitem事件中调用函数 在这里使用的是TNMFTP控件
procedure TForm1.ftpListItem(Listing: String);
begin
  addremotefile(listing);
end;procedure TForm1.Addremotefile(f:string);
var
    myfileinfo:PTFileInfo;
begin
    new(myfileinfo);
    with myfileinfo^ do
    begin
        setliststring(myfileinfo^,f);
        if (Ffilename='.') or (ffilename='..')  //忽略'.'与'..'目录
            or (ffilename='') then
        begin
            dispose(myfileinfo);
            exit;
        end;
...
end; 
==========adopt from dfw offlinet database=======

解决方案 »

  1.   

    适用于IIS 3 ,win2000的IIS 5不一样,不过只要稍微变一下就可以。
    procedure TFtpForm.NMFTP1ListItem(Listing: String);
    var
        a:tlistitem;
    begin
        a:=listview1.Items.Add;
        a.caption:=copy(listing,60,length(listing)-50);//文件名
        if pos('d',listing)=1 then
            a.subitems.add('<Dir>')//目录
        else
            a.subitems.add('File');//文件
        a.subitems.add(copy(listing,47,13));//日期
        a.subitems.add(inttostr(strtoint(copy(listing,30,16))));//长度
    end;