Python的statvfs()
方法在給定路徑上執行statvfs
系統呼叫。
語法
以下是statvfs()
方法的語法 -
os.statvfs(path)
引數
statvfs
資訊的路徑。返回值
以下是statvfs
結構的成員列表:
f_bsize
- 推薦檔案系統塊大小。f_frsize
- 基本檔案系統塊大小。f_blocks
- 檔案系統中的總塊數。f_bfree
- 空閒塊的總數。f_bavail
- 非超級使用者可用的空閒塊。f_files
- 檔案節點的總數。f_ffree
- 可用檔案節點的總數。f_favail
- 非超級使用者可用的自由節點。f_flag
- 系統依賴。f_namemax
- 最大檔案名長度。範例
以下範例顯示了statvfs()
方法的用法。
# !/usr/bin/python3
import os, sys
# showing statvfs information of file "a1.py"
stinfo = os.statvfs('a1.py')
print (stinfo)
當執行上述程式時,它會產生以下結果 -
posix.statvfs_result(f_bsize = 4096, f_frsize = 4096, f_blocks = 1909350L, f_bfree = 1491513L,
f_bavail = 1394521L, f_files = 971520L, f_ffree = 883302L, f_fvail = 883302L, f_flag = 0,
f_namemax = 255)