"Cloning" file attributes and permissions

Kevin Kelley wyldwolf at gmail.com
Fri Apr 13 08:39:42 EDT 2007


If you know what the permissions are going to be then you can use umask to
set the default file creation permissions to match. Then any files created
in that directory will have the correct permissions.

I think the "pythonic" way to solve this problem would be to code up your
own module which handles all the dirty parts in the background. It would
create the new file, stat the original, and chmod/chown the new file as
needed to match the original. All you would have to do after creating the
module is pass the new function the original and new file information.

--
Kevin Kelley

On 4/12/07, Paulo da Silva <psdasilvaX at esotericax.ptx> wrote:
>
> attn.steven.kuo at gmail.com escreveu:
> > On Apr 12, 5:19 pm, attn.steven.... at gmail.com wrote:
> >> On Apr 12, 4:09 pm, Paulo da Silva <psdasil... at esotericaX.ptX> wrote:
> >>
> ...
> >
> > After poking around a bit I also discovered the
> > shutil module.  It looks like you can use
> > shutil.copy2.  More Pythonic, yes?
> >
>
>
> I have seen that in the index but I thought it was a different thing
> because it was referenced as "high-level operations".
> Anyway that helps but I still need to copy the whole file or to use stat
> and chown for the user/group ids.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070413/b9ebea66/attachment.html>


More information about the Python-list mailing list