def nukedir(target_dir, rmdir=False):
d = os.path.normpath(target_dir)<EOL>if not os.path.isdir(d):<EOL><INDENT>return<EOL><DEDENT>files = os.listdir(d)<EOL>for f in files:<EOL><INDENT>if f == '<STR_LIT:.>' or f == '<STR_LIT:..>':<EOL><INDENT>continue<EOL><DEDENT>path = os.path.join(d, f)<EOL>if os.path.isdir(path):<EOL><INDENT>nukedir(path)<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>os.remove(path)<EOL><DEDENT>except Exception:<EOL><INDENT>print("<STR_LIT>" % path)<EOL><DEDENT><DEDENT><DEDENT>if rmdir:<EOL><INDENT>try:<EOL><INDENT>os.rmdir(d)<EOL><DEDENT>except Exception:<EOL><INDENT>print("<STR_LIT>" % d)<EOL><DEDENT><DEDENT>
Delete all the files inside target_dir.

    Usage:
        nukedir("c:/ladybug/libs", True)