Best way to copy files without Read-Only option
AKiss at GEOMETRIA.hu
Tue Sep 5 16:57:59 CEST 2000
shutil.copy2 copies last access time and last modification time and os.chmod
can set the read-only flag.
The mode parameter of os.chmod is not documented on win32(at least I haven't
find it) so you can examine the os.stat return values and then use these
constants(0x81b6 and 0x8124), or create a file in the destination dir then
use shutil.copymode to copy the mode of this new file.
"Olav" <OlavB at yahoo.com> wrote in message
news:<39B4EF5E.22DE5B90 at yahoo.com>...
> I should have though about that. But still - now I can't set the dates
> (I would like that the copied file has the same dates as the original).
> --And also I suspect it is not really efficient.
> Rainer Deyke wrote:
> > "Olav Benum" <Olav.Benum at bigfoot.com> wrote in message
> > news:39AE7EAE.51E3E692 at yahoo.com...
> > > However, I have the problem that when the source is "Read-only" the
> > > file
> > > is also read-only, creating problems later.
> > Open source file and destination file. Read from source file; write to
> > destination file. When all data has been copied, close both files.
> > --
> > Rainer Deyke (root at rainerdeyke.com)
> > Shareware computer games - http://rainerdeyke.com
> > "In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor
More information about the Python-list