IdFTP取得檔案清單後如何排序 |
答題得分者是:cmf
|
cubi
初階會員 發表:56 回覆:94 積分:35 註冊:2002-04-15 發送簡訊給我 |
|
cmf
尊榮會員 發表:84 回覆:918 積分:1032 註冊:2002-06-26 發送簡訊給我 |
var
DirectoryList:TStringList;
FileList:TStringList;
begin
DirectoryList:=TStringList.Create;;
FileList:=TStringList.Create;
// 取得目錄
IdFTP1.List(DirectoryList,'*'); // 取得檔案
IdFTP1.List(FileList,'*.*'); //DirectView 是 TListBox
//加入 目錄 及 檔案
DirectView.Items.Clear;
DirectView.Items.AddStrings(DirectoryList);
DirectView.ItemsAddStrings(FileList); DirectoryList.Free;
FileList.Free;
------
︿︿ |
cubi
初階會員 發表:56 回覆:94 積分:35 註冊:2002-04-15 發送簡訊給我 |
引言: var DirectoryList:TStringList; FileList:TStringList; begin DirectoryList:=TStringList.Create;; FileList:=TStringList.Create; // 取得目錄 IdFTP1.List(DirectoryList,'*'); // 取得檔案 IdFTP1.List(FileList,'*.*'); //DirectView 是 TListBox //加入 目錄 及 檔案 DirectView.Items.Clear; DirectView.Items.AddStrings(DirectoryList); DirectView.ItemsAddStrings(FileList); DirectoryList.Free; FileList.Free;呵,原來是這樣子呀,太感謝前輩了,謝謝 |
cubi
初階會員 發表:56 回覆:94 積分:35 註冊:2002-04-15 發送簡訊給我 |
|
cmf
尊榮會員 發表:84 回覆:918 積分:1032 註冊:2002-06-26 發送簡訊給我 |
//換個方法試試 PROCEDURE TEST; var i:integer; IsDirectory:Boolean; DirectoryList:TStringList; FileList:TStringList; begin DirectoryList:=TStringList.Create; IdFTP1.List(DirectoryList); DirectView.Items.Clear; // 找目錄 for i:=0 to DirectoryList.COUNT-1 do begin GetNameFromDirLine(DirectoryList[i],IsDirectory): if IsDirectory then DirectView.Items.Add(DirectoryList[i]); end; //找檔案 for i:=0 to DirectoryList.COUNT-1 do begin GetNameFromDirLine(DirectoryList[i],IsDirectory): if NOT IsDirectory then DirectView.Items.Add(DirectoryList[i]); end; DirectoryList.Free; end; function GetNameFromDirLine(Line: String; Var IsDirectory: Boolean): String; Var i: Integer; DosListing: Boolean; begin IsDirectory := Line[1] = 'd'; DosListing := false; for i := 0 to 7 do begin if (i = 2) and not IsDirectory then begin IsDirectory:=Copy(Line,1,Pos(' ',Line)-1)='發表人 - cmf 於 2003/04/19 13:31:01
------
︿︿ |
cmf
尊榮會員 發表:84 回覆:918 積分:1032 註冊:2002-06-26 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |