[Tutor] How do I recursively remove the contents of a directory??

Kent Johnson kent37 at tds.net
Fri Oct 21 12:11:39 CEST 2005


Suri Chitti wrote:
> If I have a directory /u01/qa/logs and the logs has a number of children 
> directories and I want to remove everything in logs and logs itself, is 
> there a single method or command to do that?  I want to avoid 
> recursively removing the files in each child directory and so on.

shutil.rmtree() (which actually does recursively remove all the children)

Kent



More information about the Tutor mailing list