This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author robbuckley
Recipients robbuckley
Date 2018-04-30.13:17:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1525094253.43.0.682650639539.issue33392@psf.upfronthosting.co.za>
In-reply-to
Content
Path.cwd().glob('/*') seems to yield all files and folders in cwd, the same as .glob('*').

I believe that glob('*/') should yield only directories, and glob('*') all files and directories. this behaviour isnt documented one way or the other. But it would be consistent with glob.glob()

console dump follows:

Python 3.6.5 |Anaconda custom (64-bit)| (default, Mar 29 2018, 13:14:23) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.3.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import os

In [2]: from pathlib import Path

In [6]: import glob

In [13]: list(p.glob('*/'))
Out[13]: 
[PosixPath('/Users/robertbuckley/python-scripts/pathlib_bug/f1.txt'),
 PosixPath('/Users/robertbuckley/python-scripts/pathlib_bug/f3.txt'),
 PosixPath('/Users/robertbuckley/python-scripts/pathlib_bug/d1'),
 PosixPath('/Users/robertbuckley/python-scripts/pathlib_bug/f2.txt'),
 PosixPath('/Users/robertbuckley/python-scripts/pathlib_bug/d2')]

In [14]: list(p.glob('*'))
Out[14]: 
[PosixPath('/Users/robertbuckley/python-scripts/pathlib_bug/f1.txt'),
 PosixPath('/Users/robertbuckley/python-scripts/pathlib_bug/f3.txt'),
 PosixPath('/Users/robertbuckley/python-scripts/pathlib_bug/d1'),
 PosixPath('/Users/robertbuckley/python-scripts/pathlib_bug/f2.txt'),
 PosixPath('/Users/robertbuckley/python-scripts/pathlib_bug/d2')]

In [15]: glob.glob(os.path.join(str(p), '*/'))
Out[15]: 
['/Users/robertbuckley/python-scripts/pathlib_bug/d1/',
 '/Users/robertbuckley/python-scripts/pathlib_bug/d2/']

In [16]: glob.glob(os.path.join(str(p), '*'))
Out[16]: 
['/Users/robertbuckley/python-scripts/pathlib_bug/f1.txt',
 '/Users/robertbuckley/python-scripts/pathlib_bug/f3.txt',
 '/Users/robertbuckley/python-scripts/pathlib_bug/d1',
 '/Users/robertbuckley/python-scripts/pathlib_bug/f2.txt',
 '/Users/robertbuckley/python-scripts/pathlib_bug/d2']
History
Date User Action Args
2018-04-30 13:17:33robbuckleysetrecipients: + robbuckley
2018-04-30 13:17:33robbuckleysetmessageid: <1525094253.43.0.682650639539.issue33392@psf.upfronthosting.co.za>
2018-04-30 13:17:33robbuckleylinkissue33392 messages
2018-04-30 13:17:33robbuckleycreate