private void CopyFile(string path, string newPath) { path = GetRelativePath(path); var file = _fileSystem.GetFile(path); if (!file.Exists) { throw new FileNotFoundException($"File {path} does not exist.", path); } try { newPath = _fileSystem.Combine(GetRelativePath(newPath), file.Name); if (_fileSystem.CheckUniqueFileName(newPath, out var uniquePath)) { newPath = uniquePath; } _fileSystem.CopyFile(path, newPath, false); Response.Write(GetResultString()); } catch (Exception ex) { throw ex; } }