Recursive glob result on non-existing directory:
>>> import os, glob
>>> os.path.exists('dir')
False
>>> glob.glob('dir/*', recursive=True)
[]
>>> glob.glob('dir/**', recursive=True)
['dir/']
Recursive glob result on existing file returned as directory:
>>> os.path.exists('file')
True
>>> glob.glob('file/*', recursive=True)
[]
>>> glob.glob('file/**', recursive=True)
['file/']
Similar commands with bash shell completion would produce following output:
$ shopt -s globstar failglob
$ ls dir
ls: cannot access 'dir': No such file or directory
$ echo dir/*
-bash: no match: dir/*
$ echo dir/**
-bash: no match: dir/**
$ touch file
$ echo file/*
-bash: no match: file/*
$ echo file/**
-bash: no match: file/**
Is there any logical explanation on glob results returned with '**' pattern or just a bug?