using os.chmod in windows

David LeBlanc whisper at oz.net
Wed Jun 19 21:12:21 EDT 2002


Well, that was bone-breakingly stupid of me. The 8th group is the last
access time LOL.

The first group is the mode bits, and that means nothing happened when the
hidden attribute was set from the File Explorer - unless I caught some
refresh lag.

David LeBlanc
Seattle, WA USA

> -----Original Message-----
> From: python-list-admin at python.org
> [mailto:python-list-admin at python.org]On Behalf Of David LeBlanc
> Sent: Wednesday, June 19, 2002 17:43
> To: Locke; python-list at python.org
> Subject: RE: using os.chmod in windows
>
>
> I didn't find any doc for this, so I tried the simple expedient of:
>
> # Attrtest.py
>
> import os
>
> os.stat('testfile.txt')
>
> raw_input('Change file attribute using File Explorer, then press return')
>
> os.stat('testfile.txt')
>
> When I did this, I got:
>
> (At the start, normal r/w file)
> >>> os.stat('testfile.txt')
> (33206, 0L, 9, 1, 0, 0, 26L, 1024026085, 1023320564, 1023320564)
> (Add hidden attribute using File Explorer)
> >>> os.stat('testfile.txt')
> (33206, 0L, 9, 1, 0, 0, 26L, 1024532993, 1023320564, 1023320564)
> (Add readonly in addition to hidden)
> >>> os.stat('testfile.txt')
> (33060, 0L, 9, 1, 0, 0, 26L, 1024532997, 1023320564, 1023320564)
>
> Notice that the last five digits (an int in decimal) of the 8th group have
> changed. How you parlay that into something chmod() can use, I
> have no idea.
>
> HTH,
>
> David LeBlanc
> Seattle, WA USA
>
> > -----Original Message-----
> > From: python-list-admin at python.org
> > [mailto:python-list-admin at python.org]On Behalf Of Locke
> > Sent: Wednesday, June 19, 2002 15:59
> > To: python-list at python.org
> > Subject: using os.chmod in windows
> >
> >
> > I never really learned the number codes for file permissions in UNIX. I
> > always just did "chmod +r" because it is much easier to remember. I need
> > to change a file to be 'hidden' in windows. In UNIX, this is done by
> > renaming it with a dot in front of the name. But the python os.chmod
> > command says you need to specify the number as the argument. As far as I
> > know, there is no number for 'hidden' since it is windows only. So how
> > do I do this?
> >
> > Thanks.
> >
> > --
> > http://mail.python.org/mailman/listinfo/python-list
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list






More information about the Python-list mailing list