{"record":{"id":"ca6bf551cab523bd","repo":"uutils/coreutils","slug":"directorynotempty","errorCode":"DirectoryNotEmpty","errorMessage":"Directory not empty","messagePattern":"Directory not empty","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"src/uu/mv/src/mv.rs","lineNumber":864,"sourceCode":"            // For backup renames, we don't need to track hardlinks as we're just moving the existing file\n            rename_with_fallback(to, backup_path, display_manager, false, None, None)?;\n        }\n    }\n\n    // \"to\" may no longer exist if it was backed up\n    // `symlink_metadata` does not follow symlinks, so a symlink to a directory\n    // is not reported as a directory, as with the previous\n    // `to.exists() && to.is_dir() && !to.is_symlink()` check\n    if to\n        .symlink_metadata()\n        .is_ok_and(|metadata| metadata.is_dir())\n    {\n        // normalize behavior between *nix and windows\n        if from.is_dir() {\n            if is_empty_dir(to) {\n                fs::remove_dir(to)?;\n            } else {\n                return Err(io::Error::new(\n                    io::ErrorKind::DirectoryNotEmpty,\n                    translate!(\"mv-error-directory-not-empty\"),\n                ));\n            }\n        }\n    }\n\n    #[cfg(unix)]\n    {\n        rename_with_fallback(\n            from,\n            to,\n            display_manager,\n            opts.verbose,\n            hardlink_tracker,\n            hardlink_scanner,\n        )?;\n    }","sourceCodeStart":846,"sourceCodeEnd":882,"githubUrl":"https://github.com/uutils/coreutils/blob/85295bbf788bfd7a6926ba692031563504b304b7/src/uu/mv/src/mv.rs#L846-L882","documentation":"Error \"Directory not empty\" thrown in uutils/coreutils.","triggerScenarios":"Occurs when mv tries to replace a non-empty directory with a rename, which the filesystem disallows (ENOTEMPTY).","commonSituations":"Moving a directory onto an existing directory that still contains files, without merging/removing the destination first.","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."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"85295bbf788bfd7a6926ba692031563504b304b7","analyzedAt":"2026-08-19T21:43:27.871Z","contentChangedAt":"2026-08-19T21:43:27.871Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}