Copy directory tree without copying files

Grant Edwards invalid at invalid.invalid
Wed Sep 23 17:44:39 CEST 2009

On 2009-09-23, Jeremy Conlin <jlconlin at> wrote:

> I am trying to copy a folder hierarchy from one location to another.
> I can use the shutil.copytree function to copy the folder tree, but I
> don't want the files copied, just the folders.  What is a good way to
> approach this?

Just in case there's no real requirement to use Python...

$ (cd srcdir; find . -type d) | (cd dstdir; xargs mkdir)

Grant Edwards                   grante             Yow! ... My pants just went
                                  at               on a wild rampage through a
                                 Long Island Bowling Alley!!

More information about the Python-list mailing list