How do I delete a folder and everything in it in Python?
ExampleCopy code to clipboard
import shutil import os boards_folder = os.path.join(os.getcwd(), 'boards') shutil.rmtree(boards_folder)
Be very careful with executing this code. Python will happily delete the root of your hard drive leaving you with a :-(
Link to documentation or other source
12 Oct 2019
Author: Max Zorin
Would you recommend this example to your colleagues?