Skip to content

Instantly share code, notes, and snippets.

@worldofchris
Created June 16, 2014 13:33
Show Gist options
  • Save worldofchris/04ceb22691240b04a80e to your computer and use it in GitHub Desktop.
Save worldofchris/04ceb22691240b04a80e to your computer and use it in GitHub Desktop.
metaldog
import os
import subprocess
import sys
import shutil
f = open("music.txt", "r")
dest_root = os.path.normpath('c:/Users/graham/Desktop/music')
src_root = os.path.normpath("d:/users/graham/music/itunes/itunes media/music/")
for line in f:
print line
src = os.path.join(src_root, os.path.normpath(line.rstrip()))
dest = os.path.join(dest_root, os.path.normpath(line.rstrip()))
(head, tail) = os.path.split(line.rstrip())
dest_dir = os.path.join(dest_root, head)
if not os.path.exists(dest_dir):
os.makedirs(dest_dir)
shutil.copy2(src, dest)
print dest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment