procedure TForm1.IdFTPServer1ListDirectory(ASender: TIdFTPServerContext;
const APath: string; ADirectoryListing: TIdFTPListOutput; const ACmd,
ASwitches: string);
var
LFTPItem :TIdFTPListItem;
SR : TSearchRec;
SRI : Integer;
begin
ADirectoryListing.DirFormat := doUnix;
SRI := FindFirst(ReplaceChars(AppDir + APath + '/*.*'), faAnyFile, SR);
While SRI = 0 do
begin
LFTPItem := ADirectoryListing.Add;
LFTPItem.FileName := SR.Name;
LFTPItem.ModifiedDate := FileDateToDateTime(SR.Time);
if SR.Attr = faDirectory then
begin
LFTPItem.ItemType := ditDirectory;
LFTPItem.Size := 0;
end
else
begin
LFTPItem.ItemType := ditFile;
LFTPItem.Size := SR.Size;
end;
SRI := FindNext(SR);
end;
FindClose(SR);
end;
此时ADirectoryListing.Count已经包含有 '.' 和 '..' 两个文件,但为什么IdFTP1端的IdFTP1.DirectoryListing.Count总是少2个,具体把文件显示出来发现就是少了 '.' 和 '..' 两个文件,如何才能让这两个文件显示出来呢?
ADirectoryListing.DirFormat := doUnix;这句有什么作用呢?
ADirectoryListing.DirFormat := doUnix;ADirectorylisting.ListFormat:=flfdos;
最新推荐文章于 2021-09-07 11:12:39 发布