[Tutor] How do I recursively remove the contents of a directory??
alan.gauld at freenet.co.uk
Fri Oct 21 10:10:21 CEST 2005
>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
os.system('rm -rf %s ' % logpath)
Sometimes its easier to use the OS directly!
If you were selectively deleting files it would be different but for
the sledgehammer case I'd pobably just go with rm...
More information about the Tutor