uutils/coreutils · error · std::io::Error
NotFound
NotFound
Error message
backing up {$target} might destroy source; {$source} not moved What it means
Error "backing up {$target} might destroy source; {$source} not moved" thrown in uutils/coreutils.
Source
Thrown at src/uu/mv/src/mv.rs:381
}
}
fn parse_paths(files: &[OsString], opts: &Options) -> Vec<PathBuf> {
let paths = files.iter().map(Path::new);
if opts.strip_slashes {
paths
.map(|p| p.components().as_path().to_owned())
.collect::<Vec<PathBuf>>()
} else {
paths.map(ToOwned::to_owned).collect::<Vec<PathBuf>>()
}
}
fn handle_two_paths(source: &Path, target: &Path, opts: &Options) -> UResult<()> {
// `mv` never follows a symlink source, so the guard must not either.
if backup_would_destroy_source(source, target, &opts.suffix, opts.backup, false) {
return Err(io::Error::new(
io::ErrorKind::NotFound,
translate!("mv-error-backup-might-destroy-source", "target" => target.quote(), "source" => source.quote()),
)
.into());
}
let Ok(source_metadata) = source.symlink_metadata() else {
return Err(if path_ends_with_terminator(source) {
MvError::CannotStatNotADirectory(source.quote().to_string()).into()
} else {
MvError::NoSuchFile(source.quote().to_string()).into()
});
};
// `symlink_metadata` does not follow symlinks, so this is equivalent to
// `source.is_dir() && !source.is_symlink()` without the extra `stat` calls.
let source_is_dir = source_metadata.is_dir();
let target_is_dir = match target.symlink_metadata() {
Ok(metadata) if metadata.is_symlink() => fs::canonicalize(target).is_ok_and(|p| p.is_dir()),View on GitHub (pinned to 85295bbf78)
Solutions
- Choose a backup path that is not inside the source file itself; verify source and backup are different files.
- Use --backup with a suffix or numbered backups so the backup never overwrites the source.
When it happens
Trigger: Occurs when mv -b would back up the destination over the source file itself, which would destroy the data being moved, so mv refuses.
Common situations: Moving a file onto its own backup name (e.g. `mv -b foo foo~`) or hard-link/backup collisions where target backup equals the source.
Understand the failure class
Background: "Not Found" / HTTP 404 Errors: What They Mean and How to Fix Them Across Libraries — this error's family across 6 libraries.
AI-assisted analysis of uutils/coreutils@85295bbf78 (2026-08-19).
Data as JSON: /api/errors/7543e3275c88259e.
Report an issue: GitHub.