[Python-Dev] A smarter shutil.copytree ? (original) (raw)
Tarek Ziadé ziade.tarek at gmail.com
Tue Apr 22 09:56:47 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 Mon, Apr 21, 2008 at 2:25 AM, Steven Bethard <steven.bethard at gmail.com> 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) ?
I made another draft based on a single callable argument to try out: http://bugs.python.org/file10073/shutil.copytree.filtering.patch
The callable takes the src directory + its content as a list, and returns filter eligible for exclusion
That makes me wonder, like Alexander said on the bug tracker: In the glob-style patterns callable, do we want to deal with absolute paths ?
Tarek
- Previous message: [Python-Dev] A smarter shutil.copytree ?
- Next message: [Python-Dev] A smarter shutil.copytree ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]