我正在尝试编写一个 python 脚本,以递归方式列出给定目录中具有绝对路径的所有文件,并在它们前面列出它们的 UID 和文件所有者。(类似于: ls -lR )我写了这个,但它在执行结束时给了我一个错误:
import os
for folder, subfolders, files in os.walk(os.getcwd()):
for file in files:
filePath = os.path.abspath(file)
print(filePath, os.stat(file).st_uid)
Run Code Online (Sandbox Code Playgroud)