summaryrefslogtreecommitdiff
path: root/python/vyos/utils/file.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/vyos/utils/file.py')
-rw-r--r--python/vyos/utils/file.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/python/vyos/utils/file.py b/python/vyos/utils/file.py
index 2af87a0ca..70ac1753b 100644
--- a/python/vyos/utils/file.py
+++ b/python/vyos/utils/file.py
@@ -149,6 +149,10 @@ def chmod_775(path):
S_IROTH | S_IXOTH
chmod(path, bitmask)
+def file_permissions(path):
+ """ Return file permissions in string format, e.g '0755' """
+ return oct(os.stat(path).st_mode)[4:]
+
def makedir(path, user=None, group=None):
if os.path.exists(path):
return