Skip to content

Instantly share code, notes, and snippets.

@Rahulsharma0810
Created November 2, 2021 05:53
Show Gist options
  • Save Rahulsharma0810/e55a2d0a4907ac86b2a2f9b2a19c1e77 to your computer and use it in GitHub Desktop.
Save Rahulsharma0810/e55a2d0a4907ac86b2a2f9b2a19c1e77 to your computer and use it in GitHub Desktop.
move-files-subdir-to-maindir
import shutil
import os
SOURCE= r'PATHA'
DESTINATION = r'PATHB'
for path, subdirs, files in os.walk(SOURCE):
for name in files:
filename = os.path.join(path, name)
print(filename)
shutil.copy2(filename, DESTINATION)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment