recipes.myglob

recipes.myglob(flpath, spattern)[source]

Return a glob-like list of paths matching a regular expression

Parameters:

flpath : str

Path to search (to search current directory use flpath=’‘ or flpath=’.’)

spattern : str

Pattern to search for in flpath

Returns:

flist : list

A Python list of all files found in flpath that match the input pattern spattern

See also

glob
Unix-style path-name and pattern expansion in Python

Examples

List all png/PNG files in the folder MyHolidayFun found under Documents

>>> myglob('Documents/MyHolidayFun','*.[Pp][Nn][Gg]')
['Documents/MyHolidayFun/img1.PNG','Documents/MyHolidayFun/img1.png']