rust-lang / glob

Support for matching file paths against Unix shell style patterns.
http://doc.rust-lang.org/glob
Apache License 2.0
447 stars 76 forks source link

"./*[!/]" Does not seem to working #103

Closed NicTanghe closed 1 year ago

NicTanghe commented 2 years ago

WHen i run

        for entry in glob("./*[!/]").expect("Failed to read glob pattern") {
            match entry {
                Ok(path) => println!("{}", path.display()),
                Err(e) => println!("{}", e),
            }
        }

I get the error

thread 'main' panicked at 'Failed to read glob pattern: PatternError { pos: 1, msg: "invalid range pattern" }', src\main.rs:28:38
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\sad.exe` (exit code: 101)

[!/] doesnt work.

Maybe [!k] does.

OS: windows ps. anny way to seperate files from folders.

mitnk commented 1 year ago

"A range containing an explicit '/' character is syntactically incorrect."

https://man7.org/linux/man-pages/man7/glob.7.html

JohnTitor commented 1 year ago

Closing in favor of https://github.com/rust-lang/glob/issues/103#issuecomment-1295766191