[Python-Dev] A smarter shutil.copytree ? (original) (raw)
Isaac Morland ijmorlan at cs.uwaterloo.ca
Mon Apr 21 02:38:03 CEST 2008
- Previous message: [Python-Dev] A smarter shutil.copytree ?
- Next message: [Python-Dev] A smarter shutil.copytree ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, 20 Apr 2008, Steven Bethard wrote:
On Sun, Apr 20, 2008 at 4:15 PM, Tarek Ziadé <ziade.tarek at gmail.com> wrote:
I have submitted a patch for review here: http://bugs.python.org/issue2663
glob-style patterns or a callable (for complex cases) can be provided to filter out files or directories. I'm not a big fan of the sequence-or-callable argument. Why not just make it a callable argument, and supply a utility function so that you can write something like:: excludefunc = shutil.excludingpatterns('*.tmp', 'testdir2') shutil.copytree(srcdir, dstdir, exclude=excludefunc)
Even if a glob pattern filter is considered useful enough to be worth special-casing, the glob capability should also be exposed via something like your excluding_patterns constructor and additionally as a function that can be called by another function intended for use as a callable argument.
If it is not, then doing something like "files matching these glob patterns except for those matching this non-glob-expressible condition and also those files matching this second non-glob-expressible condition" becomes painful because the glob part essentially needs to be re-implemented.
Isaac Morland CSCF Web Guru DC 2554C, x36650 WWW Software Specialist
- Previous message: [Python-Dev] A smarter shutil.copytree ?
- Next message: [Python-Dev] A smarter shutil.copytree ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]