Page 1 of 1

File Size

Posted: Wed 12 May 2010 23:03
by FerCastro
Hello friends,

I have been trying the Securebridge and i need to know how to retrieve the size attrib from a file allocated in the SFTP server

I am doing something like this:

Code: Select all

Attrs := TScSFTPFileAttributes.Create;
    Handle := ScSFTPClient.OpenFile(GetRootDir + slArchivos[nCicloArchivos], [foRead], Attrs);
nTamServer := Attrs.Size;

Thanks, and best regards

Posted: Thu 13 May 2010 08:53
by Dimon
To get the file size you should use the RetrieveAttributes or RetrieveAttributesByHandle method, like this:

Code: Select all

  Handle := ScSFTPClient.OpenFile(GetRootDir + slArchivos[nCicloArchivos], [foRead]); 
  Attrs := TScSFTPFileAttributes.Create; 
  ScSFTPClient.RetrieveAttributesByHandle(Attrs, Handle);
  FielSize := Attrs.Size;