How to find the size of all files on a directory o - WeOnlyDo Discussion board

How to find the size of all files on a directory o (wodSFTP / wodSFTP.NET / wodSFTPdll)

by Unilars, Thursday, October 11, 2007, 15:20 (6254 days ago)

Hi. Im useing the activex controll. And I cant figure how to get te size of all files in a folder on remote computer?

I want my VB 6.0 application to return all used size of the folder Iam connected to.

Any examples of how I can do that?

Please answer quick [:wink:]

Re: How to find the size of all files on a directo

by woddrazen, Thursday, October 11, 2007, 15:46 (6254 days ago) @ Unilars

Hi Lars,


There is no nice way to find size of remote folder because server show file size but unfortunately they don't have folder size.

I have try it with winSCP and same issue is there also.

Here is what you can try in wodFtpDLX:
[code]
...
dlx1.Blocking = True
dlx1.Connect

dlx1.ListDir /home/something/your folder

Dim i As Integer
Dim size As Long

For i = 0 To dlx1.DirItems.Count - 1
If dlx1.DirItems.Item(i).Type = typeFile Then
Debug.Print Filename: & dlx1.DirItems.Item(i).Name
size = size + dlx1.DirItems.Item(i).size
End If
Next i

Debug.Print Folder size is: & size & bytes
[/code]

Let us know how it goes.


Regards,
Drazen

Re: How to find the size of all files on a directo

by unilars, Thursday, October 11, 2007, 19:17 (6253 days ago) @ woddrazen

You are the best!

Works fine! I could't figure how this should be written!

Thanks![:cool:]