메인
차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판이전 판다음 판 | 이전 판 | ||
| 메인 [2023/10/04 08:33] – kaishoo | 메인 [2026/10/26 02:06] (현재) – 바깥 편집 127.0.0.1 | ||
|---|---|---|---|
| 줄 1: | 줄 1: | ||
| - | ======기상청 wiki====== | + | < |
| + | < | ||
| + | <div class=" | ||
| + | <h1 class=" | ||
| + | <p class=" | ||
| + | <div class=" | ||
| + | <p> | ||
| + | 거대한 기상기후데이터의 < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| - | <code python BackupDokuWiki.py> | ||
| - | # -*- coding: cp949 -*- | ||
| - | from zipfile import ZipFile | ||
| - | from datetime import date | ||
| - | import os | ||
| - | |||
| - | # 도쿠위키를 ZIP 파일로 압축 | ||
| - | def backup_dokuwiki(saveas): | ||
| - | # root directory of dokuwiki | ||
| - | DOKUWIKI_ROOT = ' | ||
| - | |||
| - | # minimum list of backup | ||
| - | # https:// | ||
| - | DIRS_TO_BACKUP = (' | ||
| - | |||
| - | # | ||
| - | with ZipFile(saveas, | ||
| - | oldpath = os.getcwd() | ||
| - | os.chdir(DOKUWIKI_ROOT) | ||
| - | for dir in DIRS_TO_BACKUP: | ||
| - | path = DOKUWIKI_ROOT + dir | ||
| - | for dirpath, dirnames, filenames in os.walk(path): | ||
| - | for filename in filenames: | ||
| - | relpath = os.path.relpath(dirpath+'/' | ||
| - | print relpath | ||
| - | zf.write(relpath) | ||
| - | os.chdir(oldpath) | ||
| - | |||
| - | # 압축된 파일을 클라우드와 동기화 | ||
| - | def moveto_cloud(filename): | ||
| - | CLOUD_PATH = ' | ||
| - | |||
| - | cloud_file = CLOUD_PATH+'/' | ||
| - | |||
| - | if os.path.exists(cloud_file): | ||
| - | os.remove(cloud_file) | ||
| - | |||
| - | os.rename(filename, | ||
| - | |||
| - | def main(argv): | ||
| - | today | ||
| - | filename = today.strftime(' | ||
| - | |||
| - | backup_dokuwiki(filename) | ||
| - | moveto_cloud(filename) | ||
| - | |||
| - | return 0 | ||
| - | |||
| - | if __name__ == ' | ||
| - | import sys | ||
| - | sys.exit(main(sys.argv)) | ||
| - | </ | ||