Filesize - WeOnlyDo Discussion board

Filesize (wodSFTP / wodSFTP.NET / wodSFTPdll)

by MWilson22000, Friday, March 12, 2010, 00:39 (5159 days ago)

Hello,

I am using vb.net with wodsftp and I would like to know how to determine the size of a file on a sftp server.

A code example would be greatly appreciated.

Sincerely,
M. Wilson

Re: Filesize

by woddrazen, Friday, March 12, 2010, 09:11 (5158 days ago) @ MWilson22000

Hi,


You can request remote server file size using GetAttributes Method. Result will be received inside Attributes Event in Size parameter.
[code]Sftp1.GetAttributes( /home/something/somefile.txt )

Private Sub Sftp1_AttributesEvent(ByVal Sender As Object, ByVal Args As WeOnlyDo.Client.SFTP.AttributesArgs) Handles Sftp1.AttributesEvent
MsgBox(Args.Size)
End Sub[/code]
Let us know how it goes.


Regards,
Drazen

Re: Filesize

by M. Wilson, Friday, March 12, 2010, 12:26 (5158 days ago) @ woddrazen

Drazen,

Thanks!

I am still slightly confused. I am new to wodsftp. So bare with me.

can I do this

dim myFileSz as sftp1.getattributes( myfile.txt )

or do I need to use listitems some how?

Much appreciated,
M. Wilson

Re: Filesize

by woddrazen, Friday, March 12, 2010, 12:34 (5158 days ago) @ M. Wilson

Wilson,


Actually you should try exactly what I mention in my last post. Of course you should first connect to your SFTP server using wodSFTP.NET.

sftp1 in my example is wodSFTP.NET reference:

Dim WithEvents Sftp1 As WeOnlyDo.Client.SFTP

So you don't need to reference GetAttributes Method.

Did you try maybe wodSFTP.NET examples maybe? You can find them in component Samples folder.

Maybe they can help you to start developing with wodSFTP.NET.


Drazen