R find time when a file was created

后端 未结 1 1481
萌比男神i
萌比男神i 2021-02-06 22:23

I am using R function list.files to get a list of files in a folder. I would also like to record when each file was created, modified and accessed

how can i do that? i t

1条回答
  •  渐次进展
    2021-02-06 23:01

    Check out file.info() for this and other file properties:

    ## 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"
    

    0 讨论(0)
提交回复
热议问题