Skip to content

Instantly share code, notes, and snippets.

@paddyzab
Created January 31, 2015 20:47
Show Gist options
  • Save paddyzab/5f37055a9b4d15c9e3e5 to your computer and use it in GitHub Desktop.
Save paddyzab/5f37055a9b4d15c9e3e5 to your computer and use it in GitHub Desktop.
Small script for cleaning resources for Android
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
import os
#Small script to change the names of the files
#containing dashes to replace them with underline
#Android asset manager cannot compile dashes, and
#sometimes it's easier to run the script than to
#bother designer to change.
#Usage
#̌Just change the mod chmod +x to executable and run it with /.replace_names.py
#get path of the current directory
path = os.getcwd()
#get all files in the current directory
files = []
files = next(os.walk(path))[2]
#iterate through the list and change the names of the files
for file_name in files:
os.rename(file_name, file_name.replace("-", "_"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment