diff --git a/crates/nu-command/src/filesystem/rm.rs b/crates/nu-command/src/filesystem/rm.rs index d56bd50cd9..05e3828b9e 100644 --- a/crates/nu-command/src/filesystem/rm.rs +++ b/crates/nu-command/src/filesystem/rm.rs @@ -231,10 +231,12 @@ fn rm( ) { Ok(files) => { for file in files { - target_exists = true; - match file { Ok(ref f) => { + if !target_exists { + target_exists = true; + } + // It is not appropriate to try and remove the // current directory or its parent when using // glob patterns.