NET SFTP Library
RenameDirectory Method
Example 






KellermanSoftware.NetSFtpLibrary Namespace > SFTP Class : RenameDirectory Method
The current directory name
The new directory name
Renames a directory in the current FTP directory
Syntax
'Declaration
 
Public Function RenameDirectory( _
   ByVal oldName As System.String, _
   ByVal newName As System.String _
) As System.Boolean
'Usage
 
Dim instance As SFTP
Dim oldName As System.String
Dim newName As System.String
Dim value As System.Boolean
 
value = instance.RenameDirectory(oldName, newName)
public System.bool RenameDirectory( 
   System.string oldName,
   System.string newName
)
public function RenameDirectory( 
    oldName: System.String;
    newName: System.String
): System.Boolean; 
public function RenameDirectory( 
   oldName : System.String,
   newName : System.String
) : System.boolean;
public: System.bool RenameDirectory( 
   System.string* oldName,
   System.string* newName
) 
public:
System.bool RenameDirectory( 
   System.String^ oldName,
   System.String^ newName
) 

Parameters

oldName
The current directory name
newName
The new directory name
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
 
//Renames a directory in the current FTP directory 
bool status = sftp.RenameDirectory("TestDir", "newDir");
 
if (status == true)
    sftp.RenameDirectory("newDir", "TestDir");
 
System.Console.WriteLine("TestDir has {0} renamed to newDir and back again", status == true ? "been" : "not been");
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
 
'Renames a directory in the current FTP directory
Dim status As Boolean = sftp.RenameDirectory("TestDir", "newDir")
 
If status = True Then
   sftp.RenameDirectory("newDir", "TestDir")
End If
 
If status = True Then
    System.Console.WriteLine("TestDir has {0} renamed to newDir and back again","been")
Else
    System.Console.WriteLine("TestDir has {0} renamed to newDir and back again","not been")
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