Last active
August 29, 2015 13:57
-
-
Save tmaybe/9363793 to your computer and use it in GitHub Desktop.
copy only the folders of a directory structure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shutil | |
import os | |
# from http://stackoverflow.com/a/15664273/958481 | |
def folders_only(dir, files): | |
return [f for f in files if os.path.isfile(os.path.join(dir, f))] | |
folderin = './hello' | |
folderout = './goodbye' | |
shutil.copytree(folderin, folderout, ignore=folders_only) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment