This small program lets a user delete a directory on their Windows system. Also good for learning from.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
import os from os import path from os.path import isdir from os.path import getsize import shutil from shutil import rmtree a = raw_input("Input the directory you want to delete(Remember to give full path ex. C:\): ") b = os.path.getsize(a) if b == 0: shutil.rmtree(a) c = isdir(a) if c == False: print 'Your directory has been deleted.'
You might want to use this to delete any directory on a Windows system. Not really as useful as cool to use and learn from. Works better on directories than files.