Skip to content

Instantly share code, notes, and snippets.

@ramen
Created June 3, 2012 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramen/2864211 to your computer and use it in GitHub Desktop.
Save ramen/2864211 to your computer and use it in GitHub Desktop.
Scrape WAVs out of Ableton projects and flatten directory tree
import os
import re
import shutil
source_dir = r'c:\dropbox\tracks\live'
dest_dir = r'C:\Users\ramen\Desktop\sp00-shared-samples'
project = 'Unknown'
for root, dirs, files in os.walk(source_dir):
if root.endswith('Project'):
project = re.sub(r'.*\\(.*) Project', r'\1', root)
for file in files:
if file.lower().endswith('.wav'):
src_path = os.path.join(root, file)
dest_path = os.path.join(dest_dir, project, file)
try:
os.makedirs(os.path.join(dest_dir, project))
except:
pass
# print src_path, '=>', dest_path
shutil.copyfile(src_path, dest_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment