rm -rf in python?

Thomas Guettler pan-newsreader at thomas-guettler.de
Fri Nov 15 02:10:22 EST 2002


On Fri, 15 Nov 2002 06:25:37 +0100, Vasisht Tadigotla wrote:


>> Is there a way (short of executing a shell command) that I can do a rm
>> -rf on a directory from python?  It raises an OSError if you try to
>> delete a directory that has contents.  I suppose that I could recurse
>> down through, deleteing as I went, but it seems that there must be an
>> easier way.
> 
> use the  rmtree() function in shutil module, works on *nix. i don't
> think it works on windows though.

AFAIK it works on windows, too.

 thomas
-- 
Thomas Guettler <guettli at thomas-guettler.de>
http://www.thomas-guettler.de



More information about the Python-list mailing list