Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/uu/mv/src/mv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,11 @@ fn move_files_into_dir(files: &[PathBuf], target_dir: &Path, options: &Options)
};

for sourcepath in files {
if !sourcepath.exists() {
show!(MvError::NoSuchFile(sourcepath.quote().to_string()));
continue;
}

if let Some(ref pb) = count_progress {
pb.set_message(sourcepath.to_string_lossy().to_string());
}
Expand Down
15 changes: 15 additions & 0 deletions tests/by-util/test_mv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1717,3 +1717,18 @@ mod inter_partition_copying {
.stderr_contains("Permission denied");
}
}

#[test]
fn test_mv_error_msg_with_multiple_sources_that_does_not_exist() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.mkdir("d");
scene
.ucmd()
.arg("a")
.arg("b/")
.arg("d")
.fails()
.stderr_contains("mv: cannot stat 'a': No such file or directory")
.stderr_contains("mv: cannot stat 'b/': No such file or directory");
}