NET FTP Library
GetDirectorySize Method
Example 






KellermanSoftware.NetFtpLibrary Namespace > FTP Class : GetDirectorySize Method
Name of the folder in the current directory
Gets the size of a remote directory in bytes
Syntax
'Declaration
 
Public Function GetDirectorySize( _
   ByVal folderName As System.String _
) As System.Long
'Usage
 
Dim instance As FTP
Dim folderName As System.String
Dim value As System.Long
 
value = instance.GetDirectorySize(folderName)
public System.long GetDirectorySize( 
   System.string folderName
)
public function GetDirectorySize( 
    folderName: System.String
): System.Int64; 
public function GetDirectorySize( 
   folderName : System.String
) : System.long;
public: System.long GetDirectorySize( 
   System.string* folderName
) 
public:
System.int64 GetDirectorySize( 
   System.String^ folderName
) 

Parameters

folderName
Name of the folder in the current directory

Return Value

The directory size, or -1 on failure
Example
FTP ftp = new FTP(); //Trial Mode            
//FTP ftp = new FTP("place user name here", "place license key here");
 
// set the name of the FTP server( its URL )
ftp.HostAddress = "ftp.fsz.bme.hu"; // a hungarian university. change this to your ftp server
ftp.UserName = "anonymous"; // replace with your user name
ftp.Password = "user@mail.com"; // replace with your password
 
//Gets the size of a remote directory  
long size = ftp.GetDirectorySize("TestDir");
 
System.Console.WriteLine("The TestDir directory has {0}( KB)", size / 1024);
Dim ftp As FTP = New FTP() 'Trial Mode
'FTP ftp = new FTP("place user name here", "place license key here");
 
' set the name of the FTP server( its URL )
ftp.HostAddress = "ftp.fsz.bme.hu" ' a hungarian university. change this to your ftp server
ftp.UserName = "anonymous" ' replace with your user name
ftp.Password = "user@mail.com" ' replace with your password
 
'Gets the size of a remote directory  
Dim size As Long = ftp.GetDirectorySize("TestDir")
 
System.Console.WriteLine("The TestDir directory has {0}( KB)", size / 1024)
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

FTP Class
FTP Members