Created
June 9, 2014 07:04
-
-
Save jpoehnelt/0f58d0702a93d50542fa to your computer and use it in GitHub Desktop.
hash by start by alphabet
This file contains hidden or 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
from os import listdir | |
from os.path import isfile, join | |
import shutil | |
def moveDirectory(src, dest): | |
try: | |
shutil.move(src, dest) | |
# Directories are the same | |
except shutil.Error as e: | |
print('Directory not copied. Error: %s' % e) | |
# Any error saying that the directory doesn't exist | |
except OSError as e: | |
print('Directory not copied. Error: %s' % e) | |
mypath = 'D:/Music' | |
for f in listdir(mypath): | |
if not isfile(join(mypath,f)) and len(f) > 1: | |
moveDirectory(join(mypath,f),''.join(['D:/Music','/',f[0],'/',f])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment