glob on windows local file system produces different results to glob.glob
Is glob intended to produce same results as glob.glob? They seem to be different at least on windows local file system.
import fs
from glob import glob
local = fs.open_fs("")
glob("test"), [x.path for x in local.glob("test")]
(['test'], []) #####################################
glob("test/*"), [x.path for x in local.glob("test/*")]
(['test\pilot'], ['/test/'])
#####################################
[x.path for x in local.glob("test/**")]
produces same results as glob("test/**", recursive=True) but takes over 6 seconds whereas native glob takes 3ms!
It seems pyfilesystem2 matches files only but glob.glob matches folders as well.
I dunno what the intended PyFilesystem behaviour is, but the documentation is unfortunately a bit ambiguous. :confused: It says both "If the glob pattern ends in a /, it will only match directory paths, otherwise it will match files and directories." and also "* Matches all files in the current directory."
It's not just on Windows. On Linux too * should match files and directories, but PyFilesystem's glob yields only files... is there any kind of system where people would expect * to match files only?