NET SFTP Library
CreateDirectory Method
Example 






KellermanSoftware.NetSFtpLibrary Namespace > SFTP Class : CreateDirectory Method
Create a directory in the current FTP directory
Syntax
'Declaration
 
Public Function CreateDirectory( _
   ByVal ftpDirectory As System.String _
) As System.Boolean
'Usage
 
Dim instance As SFTP
Dim ftpDirectory As System.String
Dim value As System.Boolean
 
value = instance.CreateDirectory(ftpDirectory)
public System.bool CreateDirectory( 
   System.string ftpDirectory
)
public function CreateDirectory( 
    ftpDirectory: System.String
): System.Boolean; 
public function CreateDirectory( 
   ftpDirectory : System.String
) : System.boolean;
public: System.bool CreateDirectory( 
   System.string* ftpDirectory
) 
public:
System.bool CreateDirectory( 
   System.String^ ftpDirectory
) 

Parameters

ftpDirectory

Return Value

True if the directory is successfully created
Example
SFTP sftp = new SFTP(); //Trial Mode            
//SFTP sftp = new SFTP("place user name here", "place license key here");
 
// set the name of the SFTP 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
 
//Creates a directory in the current FTP directory 
bool status = sftp.CreateDirectory("TestDir");
 
System.Console.WriteLine("TestDir {0} created", status == true ? "has been" : "could not be");
Dim sftp As SFTP = New SFTP() 'Trial Mode
'Dim sftp = New SFTP("place user name here", "place license key here")
 
' set the name of the SFTP 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
 
'Creates a directory in the current FTP directory
Dim status As Boolean = sftp.CreateDirectory("TestDir")
 
If status = True Then
    System.Console.WriteLine("TestDir {0} created","has been")
Else
    System.Console.WriteLine("TestDir {0} created","could not be")
End If
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