Delete empty directories
os Import
Import SYS
path = sys.argv [1]
the try:
IF os.path.exists (path):
os.rmdir (path)
Print ( "deleted successfully")
the else:
Print ( "directory does not exist")
the except OSError:
print ( "directory not empty")
Delete the directory and its subdirectories and contents
shutil Import
Import os
Import SYS
path = sys.argv [1]
IF os.path.exists (path):
shutil.rmtree (path)
Print ( "deleted successfully")
the else:
Print ( "directory does not exist")