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

w chun wescpy at gmail.com
Fri Oct 21 09:02:37 CEST 2005


On 10/20/05, Suri Chitti <SChitti at manh.com> 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.


i'd try /bin/rm -rf /u01/qa/logs from the shell.  if you have to do it
programmatically, you can use os.system() with that cmd.

hope this helps!
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2006,2001
    http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com


More information about the Tutor mailing list