Python | os.chflags() method
OS module in Python provides functions for interacting with the operating system. This comes under Python’s standard utility modules. This module provides a portable way of using operating system dependent functionality.
os.chflags() method in Python used to set the flags of path to the numeric flags; available in Unix only. Flags may take a combination (bitwise OR) of the flag values.
Syntax: os.chflag(path, flags)
Parameters:
path: A complete path of directory to be changed to new directory path.
flag: Takes combination(bitwise OR) of the following flag values –os.UF_NODUMP – Don’t dump the file.
os.UF_IMMUTABLE – File may not be changed(read-only).
os.UF_APPEND – File may only be appended to.
os.UF_OPAQUE – Directory is opaque, view through a union stack.
os.UF_NOUNLINK – File may not be renamed or deleted.
os.UF_COMPRESSED – File is stored compressed
os.UF_HIDDEN – File should not be displayed in a GUI
os.SF_ARCHIVED – File may be archived.(super user can be set)
os.SF_IMMUTABLE – File may not be changed. (super user can be set)
os.SF_APPEND – File may only be appended to. (super user can be set)
os.SF_NOUNLINK – File may not be renamed or deleted.(super user can be set)
os.SF_SNAPSHOT – File is a snapshot file. (super user can be set)Returns: Doesn’t return any value
# Python3 program to change directory # of file using os.chflags() method # import os library import os # defining path and flag path = "gfg_dir/geek.txt"flag = os..UF_IMMUTABLE # assigning val to function chflags() val = os.chflags(path, flag) # Doesn't return any value, so # nothing will be printed print("Operation successful, returning value: %s" %val) |
Output:
Operation successful, returning value: None
Recommended Posts:
- class method vs static method in Python
- Python | set() method
- Python | os.dup() method
- Python | next() method
- Python | after method in Tkinter
- Python | sys.getrecursionlimit() method
- Python PIL | eval() method
- Python | sympy.rf() method
- Python | os.readlink() method
- Python | os.getpgid() method
- Python | sys.getdefaultencoding() method
- Python | os.tcgetpgrp() method
- Python PIL | ImagePalette() Method
- Python | sympy.ff() method
- Python | sympy.nT() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : nidhi_biet


