Skip to content

Instantly share code, notes, and snippets.

@kitsunde
Created November 24, 2012 19:50
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 kitsunde/4141184 to your computer and use it in GitHub Desktop.
Save kitsunde/4141184 to your computer and use it in GitHub Desktop.
remove whitespace from dirs if there's no file named .lut in the dir
#!/usr/bin/python
def de_specify_dirs():
import os
for dir in os.listdir('./'):
if not os.path.isdir(dir): continue
path = os.path.join('./', dir)
if [ file for file in os.listdir(path) if file.endswith('.lut') ]:
continue
os.rename(path, path.replace(' ', '_'))
if __name__ == "__main__":
de_specify_dirs()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment