Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. import glob
  2. import sys
  3. import os
  4. import shutil
  5.  
  6. files = glob.glob("in/*.wav")
  7. if files == []:
  8. print("No files found in in/*.wav")
  9. sys.exit()
  10.  
  11. for f in files:
  12. n = f.split(os.sep).pop()
  13. trunk, ext = os.path.splitext(n)
  14. chunks = trunk.split('-')
  15. moved = chunks.pop()
  16. chunks.insert(2, moved)
  17. newname = '-'.join(chunks)
  18. out = "out/%s%s" % (newname, ext)
  19. shutil.copy(f, out)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement