Created
October 28, 2019 17:22
-
-
Save ionox0/5865dfcd525ebf3bc7d3f43427837898 to your computer and use it in GitHub Desktop.
copying a directory structure to a new dummy structure in python
This file contains hidden or 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
# Todo: you must already be in the directory that you are trying to copy | |
output_location = '/some/other/place' | |
for (root, dirs, files) in os.walk('.'): | |
# Make the new directory | |
if not os.path.exists(os.path.join(output_location, root)): | |
os.mkdir(os.path.join(output_location, root)) | |
# Make the new (empty) files | |
for file in files: | |
open(os.path.join(*[output_location, root, file]), 'a').close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment