Copy file or directory in Python
<p>Python seems to have functions for copying files (e.g. shutil.copy) and functions for copying directories (e.g. shutil.copytree) but I haven't found any function that handles both. Sure, it's trivial to check whether you want to copy a file or a directory, but it seems like a strange omission.</p>

<p>Is there really no standard function that works like the unix "cp" command, i.e. supports both directories and files? What would be the most elegant way to work around this problem in Python?</p>

<p>edit: When I say "cp" I mean "cp -r". Sorry about that. And I want to copy any directories recursively (like "cp -r" and shutil.copytree does).</p>
