[Tutor] Delete directories recursively
john.corry at ntlworld.com
Fri Jun 16 19:55:56 CEST 2006
I had this problem a few months back. I approached it backwards. Maybe not
the right way to do it. I removed all the files and directories and then
had my exception handle the file if it was read only. The exception
handler changes the file from read-only to not read only and then calls the
Is there a better way to do it? Would appreciate feedback on the code
except OSError, inst:
From: tutor-bounces at python.org [mailto:tutor-bounces at python.org]On Behalf
Of Amresh Kulkarni
Sent: 16 June 2006 16:27
To: tutor at python.org
Subject: [Tutor] Delete directories recursively
I need to delete a directory and its sub directories. However all dir's,
sub dir;s and files have read only access. How do i do this efficeintly
using the os.walk command.
I cannot run this command on the dir as it gives me an error due to the
read only attribute. Is there any other way to do this?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor