uses IdFTP, IdGlobal, IdFTPCommon, IdAllFTPListParsers;
function fn_FtpDirectoryExists(AidFTP:TidFTP; ADir:String): Boolean;
var index:Integer;
begin
Index:=0;
Result := False;
try
AidFTP.List;
if Assigned(AidFTP.DirectoryListing) and (AidFTP.DirectoryListing.Count>0) then
begin
while Index<AidFTP.DirectoryListing.Count do
begin
with AidFTP.DirectoryListing.Items[Index] do
begin
if (trim(FileName)=trim(ADir)) and (ItemType = ditDirectory) then
begin
Result:=true;
Exit;
end;
end;
Index:=Index+1;
end;
end;
except
Result := False;
end;
end;
沒有留言:
張貼留言