Last active
December 20, 2015 00:29
-
-
Save meikj/6041720 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
#!/usr/bin/env python | |
from os import listdir, mkdir | |
from os.path import isfile, join | |
from shutil import move | |
PATH = "D:/Videos/Movies/" | |
def main(): | |
files = [ f for f in listdir(PATH) if isfile(join(PATH, f)) ] | |
folders = [ f.split('.')[0] for f in files ] | |
print("The following folders will be created (%s):" % PATH) | |
for i, f in enumerate(folders): | |
print("\t%d. %s" % (i + 1, f)) | |
if raw_input("Continue with procedure (Y/N)? ").lower() == 'y': | |
# continue with procedure | |
for f, folder in zip(files, folders): | |
src, dst = (PATH + f, PATH + folder + '/') | |
print("%s -> %s" % (src, dst)) | |
mkdir(dst) | |
move(src, dst) | |
else: | |
exit() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment