[Tutor] removedirs ?

Jason Child jasonchild at cnsp.com
Thu Dec 16 21:36:15 CET 2004


Ertl, John wrote:

>I am trying to remove a directory that has other directories and files in
>it.  I thought removedirs was supposed to do a recursive remove of files and
>directories.
>
>When I try it I get 
>
>  
>
>>>>os.removedirs("DAF")
>>>>        
>>>>
>
>Traceback (most recent call last):
>  File "<pyshell#11>", line 1, in -toplevel-
>    os.removedirs("DAF")
>  File "/home/ertlj/ertljVersion/lib/python2.3/os.py", line 167, in
>removedirs
>    rmdir(name)
>OSError: [Errno 17] File exists: 'DAF'
>
>Thanks,
>
>John Ertl
>
>
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor
>
>  
>
it seems to me that if its on a *nix box you could use the shell command 
rm -rf <target>


More information about the Tutor mailing list