Last active
August 20, 2019 08:43
-
-
Save petarnikolovski/e2265cdadc4f9fce071d8732096561bf to your computer and use it in GitHub Desktop.
Walk and replace
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 os | |
import uuid | |
tmp = '/tmp/{}'.format(uuid.uuid4()) | |
files_root = os.getcwd() | |
for root, dirs, files in os.walk(files_root): | |
root_path = root.replace(files_root, '') | |
root_path = root_path[1:] if root_path.startswith('/') else root_path | |
for file in files: | |
print(os.path.join(tmp, root_path, file)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment