Created
March 12, 2016 14:17
-
-
Save mubbashir10/54fe258bc5e330f41e17 to your computer and use it in GitHub Desktop.
A simple script (written in python) that I used to move thousands of .mp3 files from different nested folders to music folder.
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
#importing libraries | |
import os | |
import shutil | |
#define source dir | |
src_dir = "temp/" | |
#define destination dir | |
des_dir = "temp2" | |
#defines extension | |
ext = '.mp3' | |
#file walker | |
for root, dirs, files in os.walk(src_dir): | |
for file in files: | |
#to move files with above mentioned extension (remove this to move all files) | |
if file.endswith(ext): | |
#printing current file and it's name | |
print root+"/"+file | |
#moving current file | |
shutil.move(root+"/"+file, des_dir+"/"+file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment