batch script that tells me when was the last time a file has been accessed

前端 未结 3 896
执笔经年
执笔经年 2021-01-24 21:01

I have a list of sales orders in a folder. I want a batch script that can output into a txt file, when were all the files last accessed but not necessarily modified.

3条回答
  •  既然无缘
    2021-01-24 21:14

    On partitions with NTFS file system there are 3 file dates: creation date, last modification date and last access date.

    The command

    dir "path to directory" /TA /OD
    

    lists all files of the directory according to last access date with last accessed file at bottom.

    dir "path to directory" /TA /O-D
    

    list the files in reverse order with last accessed file at top.

    It is of course possible to redirect the output into a file by appending >"Name of list file with path.log"

    But don't trust the last access time too much as it is really not reliable on when a file was last time opened for read only.

    For more parameters of command dir open a command prompt window and enter dir /?

提交回复
热议问题