Created
March 1, 2017 06:39
-
-
Save sysint64/361c04cfc8412cbc48469db2f702746c to your computer and use it in GitHub Desktop.
copy android files with suffixes hdpi, mdpi etc. to folders minimap-hdpi, minimap-mdpi etc. without suffixes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob, os | |
from shutil import copyfile | |
suffixes = [ | |
"xxxhdpi", | |
"xxhdpi", | |
"xhdpi", | |
"hdpi", | |
"mdpi", | |
] | |
for filename in glob.glob("*.png"): | |
copy_filename = None | |
current_suffix = None | |
for suffix in suffixes: | |
p = filename.find(suffix) | |
if p != -1: | |
copy_filename = filename[:p] + filename[p+len(suffix):] | |
current_suffix = suffix | |
break | |
if copy_filename is not None: | |
new_path = "mipmap-"+current_suffix+"/"+copy_filename | |
print(filename, "->", new_path) | |
copyfile(filename, new_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment