Python os.lchflags() Method
Example
Change the flags of a path to the numeric flags:
#Import os and stat Library
import os,stat
#set a flag
os.lchflags("/tmp/test.txt", stat.UF_IMMUTABLE)
Definition and Usage
The os.lchflags()
method changes the flags of a path to the numeric flags.
This method is equivalent to os.chflags()
, but it does not follow symbolic links.
Note: Available on UNIX platforms only.
Syntax
os.lchflags(path, flags)
Parameter Values
Parameter | Description |
---|---|
path | Required. Specifies the file path to set the flag |
flags | Required. Specifies the flag(s). Can be a combination of one or more flag
constants:
|
Technical Details
Return Value: | None |
---|---|
Python Version: | 2.6 |
Change Log: | 3.6 - Accepts a path-like object |