NET SFTP Library
GetDirectorySize Method
Example 






KellermanSoftware.NetSFtpLibrary Namespace > SFTP 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 SFTP
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
SFTP sftp = new SFTP(); //Trial Mode            
            //SFTP sftp = new SFTP("place user name here", "place license key here");
             
            // set the name of the SSH server( its URL )
            sftp.HostAddress = "some.sftp.server.com"; // replace with your SFTP server
            sftp.UserName  = "anonymous"; // replace with your user name
            sftp.Password = "user@mail.com"; // replace with your password
             
            //Gets the size of a remote directory  
            long size = sftp.GetDirectorySize("TestDir");
             
            System.Console.WriteLine("The TestDir directory has {0}( KB)", size / 1024);
Dim sftp As SFTP = New SFTP() 'Trial Mode
            'Dim sftp As SFTP = New SFTP("place user name here", "place license key here");
             
            ' set the name of the SSH server( its URL )
            sftp.HostAddress = "some.sftp.server.com" ' replace with your SFTP server
            sftp.UserName  = "anonymous" ' replace with your user name
            sftp.Password = "user@mail.com" ' replace with your password
             
            'Gets the size of a remote directory  
            Dim size As Long = sftp.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

SFTP Class
SFTP Members