티스토리 뷰
import datetime
import os
from shutil import copyfile, copystat
s = datetime.datetime.now()
dir_name = str(s).replace(' ','_')
os.mkdir(dir_name)
os.chdir(dir_name)
for root, dirs, files in os.walk('/var/log'):
for f in files:
if 'log' in f:
src = root + '/' + f
copyfile(src, './' + f)
copystat(src, './' + f)
리눅스 로그 파일을 자동으로 백업 해주는 코드입니다.
'Programming > Python' 카테고리의 다른 글
[Python] VirusTotal API 사용하기 (2) | 2019.03.27 |
---|
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Level 01
- pwnable
- Basic RCE
- Advance RCE
- c++
- 17th HackingCamp CTF
- Level 06
- Reversing
- Android
- unity2d
- HackingCamp
- ftz
- Write-up
- 풀이
- hackerschool
- Level 02
- CodeEngn
- reversing.kr
- C#
- 멘토링
- 안드로이드 멘토링
- Level 03
- Level 04
- Level 05
- 유니티
- Unity
- 안드로이드
- xcz.kr
- wargame
- Programming
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함