Delete directory recursively



    Python public recipes

    Deletes the content of a directory recursively.

    import shutil
    # if ignore_errors is False, an exception is raised if some parts of the directory cannot be removed
    shutil.rmtree(directory, ignore_errors=False)
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.