yolk::util

Function rename_safely

Source
pub fn rename_safely(
    original: impl AsRef<Path>,
    new: impl AsRef<Path>,
) -> Result<()>
Expand description

Rename or move a file, but only if the destination doesn’t exist. This is a safer verison of std::fs::rename that doesn’t overwrite files.