REPOST: Re: Manipulating Win32 attributes; newbie question.

Martin Bless m.bless at gmx.de
Sun Dec 30 18:52:36 EST 2001


[Peter <pcc at ecet.vtc.edu>]:

>My problem is that I need to manipulate some Win32 specific file 
>attributes.

Here's the route I'm exploring to address the same issue:

<snippet>
if 1:
    import win32file
    print win32file.FILE_ALL_ACCESS
    print win32file.FILE_ATTRIBUTE_ARCHIVE
    print win32file.FILE_ATTRIBUTE_COMPRESSED
    print win32file.FILE_ATTRIBUTE_HIDDEN
    print win32file.FILE_ATTRIBUTE_NORMAL
    print win32file.FILE_ATTRIBUTE_OFFLINE
    print win32file.FILE_ATTRIBUTE_READONLY
    print win32file.FILE_ATTRIBUTE_SYSTEM
    print win32file.FILE_ATTRIBUTE_TEMPORARY

    fattr = win32file.GetFileAttributes( fname)
    print win32file.SetFileAttributes( fname, fattr ^

win32file.FILE_ATTRIBUTE_READONLY)
    # & and
    # | or
    # ^ xor
    # -
    # +
    # ~ invert = -(x+1)

    # reset readonly bit
    fattr = fattr & (win32file.FILE_ATTRIBUTE_READONLY ^ -1)
</snippet>

Martin

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsxfer.interpacket.net!news-xfer.nuri.net!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: m.bless at gmx.de (Martin Bless)
Newsgroups: comp.lang.python
Subject: cmsg cancel <3c2fa7ac.4031975 at news.muenster.de>
Control: cancel <3c2fa7ac.4031975 at news.muenster.de>
Date: Mon, 31 Dec 2001 04:29:19 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: <cancel.3c2fa7ac.4031975 at news.muenster.de>
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009774016 27193 211.57.49.2 (31 Dec 2001 04:46:56 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:46:56 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.



More information about the Python-list mailing list