Advertisement
illlitr8

Untitled

Apr 25th, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. import os, sys
  2. if len(sys.argv) != 2:
  3.  print "Usage: python foobar.py <folder path>"
  4. else:
  5.  path = sys.argv[1]
  6.  os.chdir(path)
  7.  for f in os.listdir("."):
  8.   if f.lower().endswith(".mp3"):
  9.    n = ''.join(f.split('.')[:-1])+".txt"
  10.    np = path+"\\txts\\"
  11.    if not os.path.exists(np):
  12.     os.makedirs(np)
  13.    if not os.path.exists(np+n):
  14.     open(np+n,'w').close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement