diff --git a/crates/nu-command/src/filesystem/glob.rs b/crates/nu-command/src/filesystem/glob.rs index d6243bbc32..219853f6cb 100644 --- a/crates/nu-command/src/filesystem/glob.rs +++ b/crates/nu-command/src/filesystem/glob.rs @@ -171,8 +171,12 @@ impl Command for Glob { let folder_depth = if let Some(depth) = depth { depth - } else { + } else if glob_pattern.contains("**") { usize::MAX + } else if glob_pattern.contains(std::path::MAIN_SEPARATOR) { + glob_pattern.split(std::path::MAIN_SEPARATOR).count() + 1 + } else { + 1 }; let (prefix, glob) = match WaxGlob::new(&glob_pattern) {