NET FTP Library
RenameDirectory Method
Example 






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

FTP Class
FTP Members