Created
October 30, 2011 23:47
-
-
Save adamloving/1326599 to your computer and use it in GitHub Desktop.
Moving some mp3 files around
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
| import shutil, os, os.path | |
| root = '/Volumes/Blackmagic/Music/' | |
| dest = '/Volumes/Blackmagic/90bpm/' | |
| f = open('working.m3u') | |
| s = f.read() | |
| files = s.split('\n') | |
| i = 0 | |
| for filename in files: | |
| i = i + 1 | |
| dest_filename = filename.replace(root, dest) | |
| if os.path.exists(dest_filename): | |
| print "Path exists %s" % dest_filename | |
| else: | |
| try: | |
| os.makedirs(dest_filename) | |
| except: | |
| print 'failed to create dir (prob already exists)' | |
| if os.path.exists(dest_filename): | |
| print "%s skipping %s" % (i, dest_filename) | |
| else: | |
| print "%s %s" % (i, dest_filename) | |
| try: | |
| shutil.copy2(filename, dest_filename) | |
| except: | |
| print "failed to copy file %s" % dest_filename | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment