Nirbheek Chauhan added the comment:
> In other words, on unix shutil.rmtree is *already* 'rm -rf'.
This is not true. See:
$ mkdir testdir && chmod 200 testdir && ls -lhd testdir
d-w--- 2 nirbheek nirbheek 4.0K May 19 10:21 testdir
`rm -rf` works fine on this. But shutil.rmtree borks:
New submission from Paul Moore:
It would be useful for shutil.rmtree to have a force argument that overrode
read-only permission issues, essentially replicating the behaviour of the -f
flag in rm -rf (Unix) and the -force parameter of del (Windows Powershell).
It's possible to use the onerror
Charles-François Natali added the comment:
On Unix at least, this doesn't apply: rm -f doesn't mean ignore permissions,
but but rather don't ask confirmation which the rm commands asks in some cases
(empty file, directory, etc).
Ans the code posted wouldn't work, since the permission to remove
R. David Murray added the comment:
Actually it does apply on unix:
rdmurray@session:~/tmpls -ld foo
drwxr-x--- 2 rdmurray rdmurray 4096 Jul 22 16:09 foo
rdmurray@session:~/tmpls -l foo
total 0
-r--r- 1 rdmurray rdmurray 0 Jul 22 16:09 bar
rdmurray@session:~/tmprm -r foo
rm: remove
Charles-François Natali added the comment:
Actually it does apply on unix:
No, it does not apply: here's what I've written:
rm -f doesn't mean ignore permissions, but but rather don't ask
confirmation which the rm commands asks in some cases (empty file,
directory, etc).
Having a file
R. David Murray added the comment:
In other words, on unix shutil.rmtree is *already* 'rm -rf'. This then argues
that it *not* deleting read only files on Windows is a bug, albeit one we may
not be able to fix for backward compatibility reasons.
Ah, and now my memory is jogged. This is a
Paul Moore added the comment:
Doh. And I was even involved in the previous issue. Sorry for the noise.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22040
___
Charles-François Natali added the comment:
In other words, on unix shutil.rmtree is *already* 'rm -rf'.
Exactly :-)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22040
___