Last active
December 29, 2017 11:22
-
-
Save ChamodDamitha/099e8c27d65b48e478e9dfc28b0bccdb to your computer and use it in GitHub Desktop.
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 | |
from shutil import copyfile | |
types = [] | |
files = [f for f in os.listdir('.') if os.path.isfile(f)] | |
for f in files: | |
ext = f.split('.')[-1] | |
dirr = 'Chategorized/' + ext + "-files" | |
if ext not in types: | |
if not os.path.exists(dirr): | |
os.makedirs(dirr) | |
copyfile(f, dirr + '/' + f) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script will order the files of the directory which include the script based on the file types. Separate folders will be created for each file type. A main folder named 'Chategorized' will be created which includes the ordered directories.