Topic Path: Symbol Reference > Classes > TIdFTP Class > TIdFTP Methods > Size Method
ContentsIndexHome
PreviousUpNext
TIdFTP.Size Method

Gets file size information from the FTP server.

function Size(
    const AFileName: String
): Int64;
Parameters 
Description 
AFileName 
The file name on the remote file system. 

Integer - Size of the file, or -1 when unknown.

Size is an Integer function used to retrieve file size information for the file specified in AFilename from the FTP server. Size sends the FTP SIZE command using AFilename as an argument. 

The return value for the method is -1 when file size information for the file name specified in AFilename cannot be determined.

[Delphi]

  AFtp.ChangeDir('/public/images');

  iAvailable := GetDiskSpace('D:');
  iSize := AFtp.Size('image.jpg');

  if (iSize <> -1) and (iSize < iAvailable) then
  begin
  AFtp.Get('image.jpg', 'd:tempimage.jpg', True);
  end;
Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.