Guest User

Untitled

a guest
Oct 16th, 2018
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. import os
  2. import re
  3. import shutil
  4.  
  5. source_dir = r'c:\dropbox\tracks\live'
  6. dest_dir = r'C:\Users\ramen\Desktop\sp00-shared-samples'
  7.  
  8. project = 'Unknown'
  9.  
  10. for root, dirs, files in os.walk(source_dir):
  11. if root.endswith('Project'):
  12. project = re.sub(r'.*\\(.*) Project', r'\1', root)
  13. for file in files:
  14. if file.lower().endswith('.wav'):
  15. src_path = os.path.join(root, file)
  16. dest_path = os.path.join(dest_dir, project, file)
  17. try:
  18. os.makedirs(os.path.join(dest_dir, project))
  19. except:
  20. pass
  21. # print src_path, '=>', dest_path
  22. shutil.copyfile(src_path, dest_path)
Add Comment
Please, Sign In to add comment