Created
June 2, 2019 03:32
-
-
Save isaacgr/5f2c5a76e81b8ee0fc9a43b9b9ccb329 to your computer and use it in GitHub Desktop.
Script to move files out of a folder and into root 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 shutil | |
import os | |
def main(): | |
for root, dirs, files in os.walk(".", topdown=False): | |
for name in files: | |
if name.endswith('.bmp'): | |
thefile = os.path.join(root, name) | |
current_dir = os.getcwd() | |
shutil.move(thefile, current_dir) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment