Delete the wiki clone directory and all contained files.
()
| 43 | |
| 44 | |
| 45 | def CleanWiki(): |
| 46 | """Delete the wiki clone directory and all contained files.""" |
| 47 | |
| 48 | def errorhandler(func, path, exc_info): |
| 49 | # where func is os.listdir, os.remove, or os.rmdir; path is the argument to that function that caused it to fail; and exc_info is a tuple returned by sys.exc_info() |
| 50 | print(func) |
| 51 | print(path) |
| 52 | print(exc_info) |
| 53 | os.chmod(path, stat.S_IWRITE) |
| 54 | os.remove(path) |
| 55 | |
| 56 | try: |
| 57 | shutil.rmtree(output_dir, ignore_errors=False, onerror=errorhandler) |
| 58 | print('Old wiki clone removed') |
| 59 | except OSError: |
| 60 | print('No directory to clean found') |
| 61 | |
| 62 | |
| 63 | def CloneWiki(): |