Skip to content

Instantly share code, notes, and snippets.

@gomasaba
Created September 28, 2018 04:06
Show Gist options
  • Save gomasaba/ec6baf3da7d58974a755dc4b5cf15323 to your computer and use it in GitHub Desktop.
Save gomasaba/ec6baf3da7d58974a755dc4b5cf15323 to your computer and use it in GitHub Desktop.
collect icon file
# -*- 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