tags:

views:

172

answers:

2

How to check with python if a path has the sticky bit set?

+2  A: 

os.stat() will return a tupple of information about the file. The first item will be the mode. You would then be able to use some bit arithmetic to get for the sticky bit. The sticky bit has an octal value of 1000.

Zoredache
+6  A: 
import os
def is_sticky(path):
    return os.stat(path).st_mode & 01000 == 01000
Zach Hirsch