public void Rename([FromBody] RenameOperation op) { Console.WriteLine($"Renaming {op.OldName} to {op.NewName}"); CreateParentFolders(op.NewName); System.IO.File.Move(GetFullPath(op.OldName), GetFullPath(op.NewName)); RemoveEmptyParentFolders(op.OldName); }
private async Task PerformRename(bool remote, string oldPath, string newPath) { var op = new RenameOperation { OldName = oldPath, NewName = newPath }; if (!remote) { Rename(op); } else { await Http.PostAsync( $"{_options.PeerServer}api/mirror/rename", new StringContent( JsonConvert.SerializeObject(op), Encoding.UTF8, "application/json")); } }