New file utility for shutil - linktree.py

Greg Ward gward at python.net
Mon Dec 30 21:42:39 EST 2002


On 30 December 2002, David MacQuigg said:
> I need a 'linktree' utility to create a "mock hierarchy" for testing
> patches to our mongo software distributions (~2GB, 10,000 files,
> hundreds of dirs and symlinks, some of which are broken).  I found
> some utilities in 'shutil.py', but no good.  'copytree' copies the
> entire 2GB hierarchy!  The mock hierarchy should have just the new
> patch files, and links for everything else.

Look closely at distutils.file_util.copy_file() and
distutils.dir_util.copy_tree(); I think they're pretty close to what you
want.  The only obvious deficiency is that copy_tree() doesn't have a
'link' argument like copy_file() does.  That should be easy to add --
submit a patch, do *not* assign it to me, argue for it on distutils-sig,
and hopefully someone will check it in in time for Python 2.3.  Or you
can just steal the code...

        Greg
-- 
Greg Ward <gward at python.net>                         http://www.gerg.ca/
Laziness, Impatience, Hubris.




More information about the Python-list mailing list