ReadWriteFileSystemProvider.Rename Method
Namespace: Rebex.IO.FileSystem
Assembly: Rebex.FileSystem.dll (version 7.0.9147)
Rename(NodeBase, String)
Override this method to implement renaming a Directory
When the virtual file system is used in the FileServer component, the server session, which contains information about the user and the active connection, can be accessed using Current property.
Declaration
protected abstract NodeBase Rename(NodeBase node, string newName)
Parameters
Type | Name | Description |
---|---|---|
Node |
node | A Directory |
String | newName | New |
Returns
Type | Description |
---|---|
Node |
Up-to-date instance of File
Returned instance should have the Name property set to |
Examples
protected override NodeBase Rename(NodeBase node, string newName)
{
var oldPath = getFullPath(node.Path);
var newPath = getFullPath(node.Path.ParentPath.AddPathPart(newName));
if (node.IsDirectory)
{
Directory.Move(oldPath, newPath);
return new DirectoryNode(newName, node.Parent);
}
File.Move(oldPath, newPath);
return new FileNode(newName, node.Parent);
}