When coding in Python, I often need to write a function like this one:
def delete_dir(dir_name):
if os.path.exists(dir_name):
reply = raw_input("Delete directory "+dir_name+"? [y/[n]] ")
if reply== y :
os.system( rm -r +dir_name)
else:
print "Aborting..."
sys.exit()
Which is basically just a remove command with a user prompt to double-check (I also have one for deleting files). Given the large amounts of Python modules out there, including in the standard library, I m wondering if something like this already exists out there?