A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.tutorialspoint.com/python/os_lchflags.htm below:

Python os.lchflags() Method

Python os.lchflags() Method

Python method lchflags() sets the flags of path to the numeric flags. This method does not follow symbolic links unlike chflags() method.

Here, flags may take a combination (bitwise OR) of the following values (as defined in the stat module) −

Note − The Python os.lchflags() method is available only on UNIX platforms.

Syntax

Syntax of os.getcwdu() method is shown below −

os.lchflags(path, flags)
Parameters

The Python os.lchflags() method accepts the following parameters −

Return Value

The os.lchflags() method in Python does not return any value.

Example

The following example shows the usage of lchflags() method.

#!/usr/bin/python

import os, sys

# Open a file
path = "/var/www/html/foo.txt"
fd = os.open( path, os.O_RDWR|os.O_CREAT )

# Close opened file
os.close( fd )

# Now change the file flag.
ret = os.lchflags(path, os.UF_IMMUTABLE )

print ("Changed file flag successfully!!")

When we run above program, it produces following result −

Changed file flag successfully!!

python_files_io.htm


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4