uutils/coreutils · error · std::io::Error
DirectoryNotEmpty
DirectoryNotEmpty
Error message
Directory not empty
What it means
Error "Directory not empty" thrown in uutils/coreutils.
Source
Thrown at src/uu/mv/src/mv.rs:864
// For backup renames, we don't need to track hardlinks as we're just moving the existing file
rename_with_fallback(to, backup_path, display_manager, false, None, None)?;
}
}
// "to" may no longer exist if it was backed up
// `symlink_metadata` does not follow symlinks, so a symlink to a directory
// is not reported as a directory, as with the previous
// `to.exists() && to.is_dir() && !to.is_symlink()` check
if to
.symlink_metadata()
.is_ok_and(|metadata| metadata.is_dir())
{
// normalize behavior between *nix and windows
if from.is_dir() {
if is_empty_dir(to) {
fs::remove_dir(to)?;
} else {
return Err(io::Error::new(
io::ErrorKind::DirectoryNotEmpty,
translate!("mv-error-directory-not-empty"),
));
}
}
}
#[cfg(unix)]
{
rename_with_fallback(
from,
to,
display_manager,
opts.verbose,
hardlink_tracker,
hardlink_scanner,
)?;
}View on GitHub (pinned to 85295bbf78)
Solutions
- Move or delete the contents of the destination directory first, then retry the move.
- Use mv -T or rename into a non-conflicting destination name.
When it happens
Trigger: Occurs when mv tries to replace a non-empty directory with a rename, which the filesystem disallows (ENOTEMPTY).
Common situations: Moving a directory onto an existing directory that still contains files, without merging/removing the destination first.
AI-assisted analysis of uutils/coreutils@85295bbf78 (2026-08-19).
Data as JSON: /api/errors/ca6bf551cab523bd.
Report an issue: GitHub.