我正在尝试在 mac 上使用 stat
(使用 python),但使用此命令
stat --printf 'name: %n \tSize: %s bytes\t Type: %F\t Timestamp:%z\n' " + j
in python 给了我一个响应: stat: invalid option -- -
它告诉我 stat --printf 'name: %n\tSize: %s 中的一些标签bytes\t 类型:%F\t 时间戳:%z\n'
错误。
我该如何解决这个问题?
最佳答案
MacOS 上的 stat
不存在 --printf
选项。
您要查找的是-f
(用于格式)。
所以你可以这样做:
stat -f '名称:%n\t大小:%s 字节\t 类型:%F\t 时间戳:%z\n'
关于macos - 苹果电脑 : Lack of --printf for stat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42891856/