Deleting Directories

Laura McCord Laura.McCord at doucet-austin.com
Fri May 21 11:28:06 EDT 2004


Yes, I just found out about shutil() which was the key element that I
needed. I just didn't see it in the library reference.

Thanks,
 Laura

-----Original Message-----
From: python-list-bounces+laura.mccord=doucet-austin.com at python.org
[mailto:python-list-bounces+laura.mccord=doucet-austin.com at python.org]
On Behalf Of Rico Huijbers
Sent: Friday, May 21, 2004 10:22 AM
To: python-list at python.org
Subject: Re: Deleting Directories


Laura McCord wrote:
> This is probably a very basic question but I started learning python. 
> I am almost done writing my delete directory script but I am at a 
> stand still right now. I want to delete folders in my 
> "/var/www/html/da" directory that are over 1 day old.
> 
> But, when I find the folder a simple rmdir() command does not work 
> because the directory is not empty. What else do I need to do to 
> delete a directory that contains content?

Assuming you already figured out how to check the directories' 
timestamps, shutil.rmtree() will do what you want.
-- 
http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list