delete files/dirs with read-only mode

David Broadwell anti-spam.dbroadwell at mindspring.com
Thu May 1 14:44:47 EDT 2003


http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=mailman.1026489500.25324.python-list%40python.org&rnum=1&prev=/groups%3Fq%3Dwindows%2Bcommand%2Bgroup:comp.lang.python.*%26hl%3Den%26lr%3D%26ie%3DUTF-8%26group%3Dcomp.lang.python.*%26selm%3Dmailman.1026489500.25324.python-list%2540python.org%26rnum%3D1

Message on this selfsame newsgroup about interfaing with windows commands.

The command(s) you need in this case is 'attrib /?', can't remove the files
easily till they are not read only.

I'd guess you were looking for a 'attrib /s -r -s -h' but tis wisest to read
and decide for yourself.

"Andros" <andros at no_mail.com> wrote in message
news:b8rhcb$mbu$1 at apollon.grec.isp.9tel.net...
> Hello,
> how to delete an entire directory wich contain files or subdirs with
> read-only mode (windows) ?
> Is it possible to change the read-only mode for a file or dir ?
>
> Thanks
>
> >>> import shutil
> >>> shutil.rmtree('test')
> Traceback (most recent call last):
>   File "<pyshell#39>", line 1, in ?
>     shutil.rmtree('test')
>   File "F:\Python22\lib\shutil.py", line 128, in rmtree
>     raise exc[0], (exc[1][0], exc[1][1] + ' removing '+cmd[1])
> OSError: [Errno 13] Permission denied removing test\test.py
>
>






More information about the Python-list mailing list