from os.path import basename
from functools import reduce
from itertools import chain
from glob import iglob
from textwrap import dedent, indent
def globed(*paths):
return chain(*(iglob(p) for p in paths))
def basenames_asstr(*paths):
return reduce(lambda b1, b2: '{}\n{}'.format(b1, b2),
(basename(p) for p in paths))
def basenames_summary(*paths):
list = sorted(globed(*paths))
return dedent("""\
Number of Files: {}
File List:
{}""").format(len(list),
indent(basenames_asstr(*list), ' - '))