aggregate_file_exts.py 554 B

12345678910111213141516171819202122
  1. # -*- coding: utf-8 -*-
  2. #!/usr/bin/env python
  3. # 打印出所有某目录的文件后缀
  4. from base import *
  5. from apilib.utils import flatten
  6. STATIC_DIR = os.path.join(PROJECT_ROOT, 'static')
  7. @click.command()
  8. def check():
  9. file_with_ext = lambda filename: len(filename.split('.')) > 1
  10. print '|'.join(set([ e.split('.')[-1] for e in
  11. flatten(
  12. [ files for root, dirs, files in os.walk(STATIC_DIR)]) if file_with_ext(e) ]))
  13. click.echo('success!')
  14. if __name__ == "__main__":
  15. check()