Top-rated recipes tagged "path" and "paths" but not "absolute_path"http://code.activestate.com/recipes/tags/path+paths-absolute_path/top/2010-07-09T19:10:59-07:00ActiveState Code Recipesfile path generator from path patterns (Python)
2010-07-09T19:10:59-07:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/577230-file-path-generator-from-path-patterns/
<p style="color: grey">
Python
recipe 577230
by <a href="/recipes/users/4173505/">Trent Mick</a>
(<a href="/recipes/tags/cli/">cli</a>, <a href="/recipes/tags/files/">files</a>, <a href="/recipes/tags/path/">path</a>, <a href="/recipes/tags/paths/">paths</a>, <a href="/recipes/tags/walk/">walk</a>).
Revision 4.
</p>
<p>Provides a <code>_paths_from_path_patterns</code> that will generate a list of paths from a list of path patterns. A "path pattern" can include glob chars. By default it generates a recursive listing of file paths, but: recursion can be turned off, file and/or dir paths can be listed. It supports a list of glob exclusions or inclusions.</p>
<p>This function makes it easy to implement typical "-r|--recursive" and "-x|--exclude" options for command-line scripts that work on given file paths. See <a href="#block-1">example usages below</a>.</p>
<p>Note: I use a leading <code>_</code> on function names because my typical usage of my recipes is as re-usable <em>internal</em> functions in Python modules.</p>