chikuchikugonzalezの雑記帳

趣味とか日記とかメモとか(∩゚д゚)

charsフォルダ内でdefファイルを探すスクリプト

M.U.G.E.Nのcharsフォルダで実行すると、見つかった.defファイルをcharsフォルダ以下の相対パスとしてリストするスクリプト書いた。コマンドラインでselect.defに書ける.defの一覧が欲しい、とかいう狭すぎる要望を叶えます。

#!python
# -*- coding: utf-8 -*-

import os
import os.path

charDir = os.getcwd();

for root, dirs, files in os.walk(charDir):
    for file in files:
        if file.lower().endswith('.def'):
            print os.path.join(root, file)[len(charDir)+1:].replace('\\', '/')