uses WinInet;
function GetfileSize(Host
Char;UserID
Char;Password
Char;FileName
Char):longint;
function GetfileSize(Host
Char;UserID
Char;Password
Char;FileName
Char):longint;
var
FindData: TWin32FindData;
FindHandle: HInternet;
FINet: HInternet;
FFtpHandle: HInternet;
FileSize:LongInt;
begin
FileSize:=0;
finet:=internetopen('main',0,nil,0,0);
FftpHandle := InternetConnect(FINet, Host, 0,
UserID, Password,
Internet_Service_Ftp, 0, 255);
if FFtpHandle = nil then
FileSize:=0
else
begin
FindHandle := FtpFindFirstFile(FFtphandle, pchar('/'+FileName),
FindData, 0, 0);
if FindHandle=nil then
begin
FindHandle := FtpFindFirstFile(FFtphandle, pchar('/Backup/'+FileName),
FindData, 0, 0);
if FindHandle=nil then
FileSize :=0
else
FileSize :=FindData.nFileSizeHigh*255+FindData.nFileSizeLow;
end
else
begin
FileSize :=FindData.nFileSizeHigh*255+FindData.nFileSizeLow;
end;
end;
InternetCloseHandle(finet);
result :=FileSize;
end;