(path)
| 13 | print os.path.basename(sys.argv[0]), '<directory>' |
| 14 | |
| 15 | def delete(path): |
| 16 | for name in os.listdir(path): |
| 17 | path_name = os.path.join(path, name) |
| 18 | try: |
| 19 | if os.path.isdir(path_name): |
| 20 | delete(path_name) |
| 21 | os.rmdir(path_name) |
| 22 | elif os.path.isfile(path_name): |
| 23 | os.remove(path_name) |
| 24 | except: |
| 25 | print 'ERROR:', path_name |
| 26 | |
| 27 | if __name__ == '__main__': |
| 28 | main(r'C:\Documents and Settings\SCHAP472') |