diff --git a/crates/nu-command/src/filesystem/touch.rs b/crates/nu-command/src/filesystem/touch.rs index 15c7da865c..095f3e556d 100644 --- a/crates/nu-command/src/filesystem/touch.rs +++ b/crates/nu-command/src/filesystem/touch.rs @@ -136,7 +136,12 @@ impl Command for Touch { } } - if let Err(err) = OpenOptions::new().write(true).create(true).open(&item) { + if let Err(err) = OpenOptions::new() + .write(true) + .create(true) + .truncate(false) + .open(&item) + { return Err(ShellError::CreateNotPossible { msg: format!("Failed to create file: {err}"), span: call