Registering renames

Use the RegisterRename method to rename a file.


void RegisterRename(string sourceFile, string destinationFile, Etag etag = null);
void RegisterRename(FileHeader sourceFile, string destinationFile, Etag etag = null);
sourceFile string The full file path to change
sourceFile FileHeader The file that you want to rename represented by the FileHeader
destinationFile string The new file path
etag Etag The current file Etag, used for concurrency checks (null will skip the check)


If the requested file does not exist in the file system, the FileNotFoundException will be thrown by the SaveChangesAsync.

Rename and move

Rename and move is basically the same operation. Directories in RavenFS are a virtual concept, which relies on the file paths. So if you want to move a file into a different "directory", simply rename it.


session.RegisterRename("/movies/intro.avi", "/movies/introduction-to-ravenfs.avi");

await session.SaveChangesAsync();