Python Glossary Русский

Python 3.4+statfunction

stat.S_ISWHT()

file type

Checks from st_mode that the object is a whiteout, an "erased" entry of a BSD or macOS union file system.

Syntax

stat.S_ISWHT(os.stat(path).st_mode)

A whiteout marks a file deleted from the upper layer of a union mount. On Linux the stat.S_IFWHT constant is 0 and the function always gives False; Docker overlays on Linux mark deletions with a 0:0 character device instead, so S_ISWHT does not recognise them. The function exists since Python 3.4.

Examples

import os, stat
open('f.txt', 'w').close()
print(stat.S_ISWHT(os.stat('f.txt').st_mode))  # → False
print(stat.S_IFWHT)  # → ? 0 на Linux и Windows, 57344 на macOS

See also

Open in the full glossarydocs.python.orgReport an inaccuracy