Created
January 21, 2016 04:20
-
-
Save napjon/71e54e49b985f1776691 to your computer and use it in GitHub Desktop.
Move recursive copy from sub directory to root destination http://stackoverflow.com/questions/7432197/python-recursive-find-files-and-move-to-one-destination-directory
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 fnmatch | |
import os | |
import shutil | |
matches = [] | |
for root, dirnames, filenames in os.walk(rootPath): | |
for filename in filenames: | |
matches.append(os.path.join(root, filename)) | |
print(os.path.join(root, filename)) | |
shutil.move(os.path.join(root, filename), os.path.join(destDir, filename)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment