Created
September 28, 2018 04:06
-
-
Save gomasaba/ec6baf3da7d58974a755dc4b5cf15323 to your computer and use it in GitHub Desktop.
collect icon file
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
# -*- coding: utf-8 -*- | |
# stdlib | |
import os | |
import glob | |
from contextlib import contextmanager | |
import shutil | |
icon_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'icons') | |
os.makedirs(icon_dir,exist_ok=True) | |
@contextmanager | |
def cd(newdir): | |
prevdir = os.getcwd() | |
os.chdir(os.path.expanduser(newdir)) | |
try: | |
yield | |
finally: | |
os.chdir(prevdir) | |
with cd('path/material-design-icons-master/'): | |
files = glob.glob('**/1x_web/*_18dp.png', recursive=True) | |
for file in files: | |
try: | |
shutil.move(file, icon_dir) | |
except: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment