【发布时间】:2013-09-27 18:59:10
【问题描述】:
我正在尝试获取 AppleScript 中文件的最后修改日期。我以为我可以使用:
set thePath to (((path to documents folder) as text) & "speed.txt")
set modDate to modification date of file thePath
这似乎返回了一个有效值,但是当我把它放在on idle 的代码中时,我得到一个:
“无法获得类 of...”错误
我在其他地方看到了使用建议:
set the modDate to (do shell script "mdls -name kMDItemLasUsedDate " & quoted form of the POSIX path of thePath)
但这会返回null。关于如何获得修改日期的任何想法?
【问题讨论】:
-
必须是 applescript 吗?您可以使用 stat filename 轻松做到这一点
-
仅供参考:对于您的 do shell 脚本命令,有一个“kMDItemContentModificationDate”可以工作。
标签: file applescript last-modified