我正在使用 R 函数 list.files 来获取文件夹中的文件列表。我还想记录每个文件的创建、修改和访问时间
我怎样才能做到这一点?我试过谷歌搜索,但没有找到任何有用的命令
下面的截图来自我的 Windows 机器。当我右键单击文件名并单击“属性”时我得到它
最佳答案
退房 file.info()
对于这个和其他文件属性:
## With a single path
p <- R.home()
file.info(p)$ctime
# [1] "2014-11-20 08:15:53 PST"
## With a vector of multiple paths
paths <- dir(R.home(), full.names=TRUE)
tail(file.info(paths)$ctime)
# [1] "2014-11-20 09:00:45 PST" "2014-11-20 09:00:47 PST"
# [3] "2014-11-20 09:00:47 PST" "2014-11-20 09:00:50 PST"
# [5] "2014-11-20 09:00:33 PST" "2014-11-20 09:00:33 PST"
关于R 查找文件创建时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27066620/