티스토리 뷰
shutil.rmtree(path[, ignore_errors[, onerror]])
Delete an entire directory tree; path must point to a directory (but not a symbolic link to a directory). If ignore_errors is true, errors resulting from failed removals will be ignored; if false or omitted, such errors are handled by calling a handler specified by onerror or, if that is omitted, they raise an exception.
If onerror is provided, it must be a callable that accepts three parameters: function, path, and excinfo. The first parameter, function, is the function which raised the exception; it will be os.path.islink(), os.listdir(),os.remove() or os.rmdir(). The second parameter, path, will be the path name passed to function. The third parameter, excinfo, will be the exception information return by sys.exc_info(). Exceptions raised by onerror will not be caught.
Changed in version 2.6: Explicitly check for path being a symbolic link and raise OSError in that case.
출처 : https://docs.python.org/2/library/shutil.html
1. 소스입니다. 주석으로 설명을 대체하겠습니다.
2. 스크립트가 잘 동작하는지 보기 위해서 폴더들을 생성하고, 폴더 안에 파일들을 무작위로 넣어 보겠습니다.
3. 스크립트를 실행한 후의 모습입니다.
위 스크립트를 응용하면 재미있는 발상들이 쏟아져 나오네요 :)
'프로그래밍 > Python' 카테고리의 다른 글
| [Python]dex2jar, apktool 이용한 apk 디컴파일 자동화 (0) | 2016.01.17 |
|---|---|
| [Zipfile of python] 해당 경로의 모든 zip파일 풀기(+암호) (9) | 2016.01.16 |
| [Python] struct 정리 (0) | 2016.01.15 |
| [Telegram Bot API Token 생성하기] (6) | 2016.01.13 |
| [Telegram CLI] Python을 이용하여 Telegram Bot 만들기 (5) | 2016.01.13 |
- Total
- Today
- Yesterday
- VirusBulletin
- koodous
- 스피어피싱
- 악성코드
- Servey
- Yara
- 출처 : Do it 안드로이드 프로그래밍
- idapython
- 한글악성코드
- 위협정보공유
- CVE-2018-0798
- Bisonal
- Cisco Talos
- vuln
- Static Analysis Engine
- keylogger
- infostealer
- cuckoo-sandbox
- .wll
- 비트코인
- malware
- us-cert
- Decoding
- CVE-2018-9375
- Flybits
- 멋쟁이사자처럼 4기
- Kimsuky
- AMSI
- MS-Office
- 해킹메일
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |