Drkcore

11 06 2011 Python Tweet

Emacsのバックアップファイルを削除する

シェルだったら

find . -name '*~' -print | xargs rm

に適当なaliasきっとけばいいんだけど、pythonで。

import os
import re

end_with_childe = re.compile('.*~$')

for root, dir, files in os.walk('.'):
    for file in files:
        if end_with_childe.match(file):
            os.remove(os.path.join(root, file))

About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021