How to do force remove in Python like rm -rf on Linux?

python

Solution

shutil is your friend in this instance.

http://docs.python.org/2/library/shutil.html#shutil.rmtree

import shutil
shutil.rmtree("/my/path/to/folder/to/destroy")

Problem

I want to remove some log files of my App server without shutting down my server. What command can I use to do this using Python, like `rm -rf` in Linux systems? Please help.

Original source

Related problems