클라스 이용해서 파일 정리하는 유틸 만들고
이젠 파이썬 비기너 개념 완전히 접고 Flask 에 매진함.
바탕화면에 있는 짤방이나 텍스트 파일 정리하는 유틸임.
확장자랑 원하는 디렉토리만 적어주면 알아서 들어가버리게 만든거임..
파이썬 기본 끗..
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 #
4 # align_file.py
5 #
6 # Copyright 2015 pugc <호스트네임>
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21 # MA 02110-1301, USA.
22 #
23 #
24
25
26
27 import os,glob
28
29 class jjal_align:
30
31 @staticmethod
32 def picalign(gst,t_name):
33 get_globs = glob.glob(gst)
34 for i in get_globs:
35 os.system("mv {fname} {targets}".format( fname=i, targets=t_name ) )
36
37
38
39 doit = jjal_align()
40
41 doit.picalign("*.jpg","짤방/")
42 doit.picalign("*.jpeg","짤방/")
43 doit.picalign("*.gif","짤방/")
44 doit.picalign("*.png","짤방/")
45 doit.picalign("*.py","pyex/")
~
~
댓글 0