读书人

用indy时候如何浏览客户端文件

发布时间: 2012-02-04 15:43:08 作者: rapoo

用indy时候怎么浏览客户端文件
indy用tcpserver 和tcpclient 怎么在服务器端浏览客户端的目录和文件啊

[解决办法]
用ftp
[解决办法]
本地读取目录结构,发给服务器就是了
[解决办法]
要是贴出来是在是天长了
一下是服务端上的。扫描驱动器和目录

Delphi(Pascal) code
procedure GetDrivernum(var DiskList: TStringList);var  i: Char;  AChar: array[1..3] of char;  j: integer;  drv: PChar;begin  for i := 'C' to 'Z' do  begin    if DiskInDrive(i) then    begin      AChar[1] := i;      AChar[2] := ':';      AChar[3] := #0;      drv := @AChar;      J := GetDriveType(drv);      if J = DRIVE_REMOVABLE then        DiskList.Add(i + ':\'); //(4软盘)      if J = DRIVE_FIXED then        DiskList.Add(i + ':\'); //(1硬盘)      if J = DRIVE_REMOTE then        DiskList.Add(i + ':\'); //(3网络映射)      if J = DRIVE_CDROM then        DiskList.Add(i + ':\'); //(2光盘)      if J = DRIVE_RAMDISK then        DiskList.Add(i + ':\'); // (4虚拟盘)      if J = DRIVE_UNKNOWN then        DiskList.Add(i + ':\'); // (4未知盘)    end;  end;  end;//上面一个获取驱动列表。。。。。。。。。。// 下面一个获取指定目录下的文件夹和文件列表function FindFile(Path: string): string; {搜索文件夹和文件}var Sr: TSearchRec;  CommaList: TStringList;  s: string;  dt: TDateTime;begin  commalist := Tstringlist.Create;  try    Findfirst(path + '*.*', faAnyFile, sr);    if ((Sr.Attr and faDirectory) > 0) and (Sr.Name <> '.') then    begin      dt := FileDateToDateTime(sr.Time);      s := FormatDateTime('yyyy-mm-dd hh:nn', dt);      commalist.add('*' + s + sr.name);    end;    while findnext(sr) = 0 do    begin      if ((Sr.Attr and faDirectory) > 0) and (Sr.Name <> '..') then      begin        dt := FileDateToDateTime(sr.Time);        s := FormatDateTime('yyyy-mm-dd hh:nn', dt);        commalist.add('*' + s + sr.name);      end;    end;    FindClose(sr);    FindFirst(path + '*.*', faArchive + faReadOnly + faHidden + faSysFile, Sr);    if Sr.Attr <> faDirectory then    begin      dt := FileDateToDateTime(sr.Time);      s := FormatDateTime('yyyy-mm-dd hh:nn', dt);      commalist.add('\' + s+ Format('%.0n', [sr.Size / 1]) + '|' + sr.name);    end; //Inttostr(    while findnext(sr) = 0 do    begin      if (sr.Attr <> faDirectory) then      begin        dt := FileDateToDateTime(sr.Time);        s := FormatDateTime('yyyy-mm-dd hh:nn', dt);        commalist.add('\' + s +Format('%.0n', [sr.Size / 1]) + '|' + sr.name);      end;    end;    FindClose(Sr);  except  end;  Result := commalist.Text;     //Result是消息的 定义  commalist.Free;end; 

读书人网 >.NET

热点推荐