hidden attribute on Windows files

John Machin sjmachin at lexicon.net
Mon Mar 7 22:10:18 CET 2005


rbt wrote:
> How do I enable the hidden attribute when creating files on Windows
> computers? I'd *really* prefer to do from the standard Python
installer
> (no win32 extensions). Any tips?
>
> Thanks

Breaking your problem down a bit:
1. How is that done from the command line in Windows?
2. How to execute an os command line from within stock-standard Python?

Which of those parts are you having trouble with?

If you want to help yourself, DON'T read the end of this message ...







=== Warning: spoon-feeding follows ===

[results of "dir" command are trimmed down to the bare essentials]

C:\junk\hidatt>dir
08/03/2005  07:56a      <DIR>          .
08/03/2005  07:56a      <DIR>          ..
08/03/2005  07:56a                  13 fubar

C:\junk\hidatt>python
Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> r = os.system('attrib +h fubar')
>>> r
0
>>> r = os.system('dir')
08/03/2005  07:56a      <DIR>          .
08/03/2005  07:56a      <DIR>          ..
>>> r = os.system('attrib -h fubar')
>>> r = os.system('dir')
08/03/2005  07:56a      <DIR>          .
08/03/2005  07:56a      <DIR>          ..
08/03/2005  07:56a                  13 fubar
>>>




More information about the Python-list mailing list