Re: [Tutor] How do I recursively remove the contents of a directory??
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 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How do I recursively remove the contents of a directory??
>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... Alan g ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How do I recursively remove the contents of a directory??
On 10/20/05, Suri Chitti <[EMAIL PROTECTED]> 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 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] How do I recursively remove the contents of a directory??
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. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor