【问题标题】:Learning when was the last time a file is accessed了解最后一次访问文件是什么时候
【发布时间】:2015-01-31 07:07:47
【问题描述】:

我想知道是否可以了解上次访问文件的时间是什么时候。我的意思是当 Windows 中的 .dll 文件被任何其他程序使用时。我想知道任何操作系统中是否有任何功能可以保留文件的最后访问日期或扩展名。

谢谢!

【问题讨论】:

    标签: operating-system filesystems kernel


    【解决方案1】:

    Unix 提供 stat 命令或 fstat() 函数来获取文件的最后访问时间。

    eos$ stat file
    File: `file'
    Size: 280486          Blocks: 548        IO Block: 4096   regular file
    Device: 12h/18d Inode: 1963857568  Links: 1
    Access: (0600/-rw-------)  Uid: (83991/ vshesha)   Gid: (  108/    abcd)
    Access: 2014-09-16 15:39:09.000000000 -0400
    Modify: 2014-09-16 15:39:09.000000002 -0400
    Change: 2014-09-16 15:39:09.000000000 -0400
    

    对于 Windows,请参阅post

    【讨论】:

      【解决方案2】:

      这是文件系统/操作系统的一个特性。如果是 Windows 和它的默认文件系统 NTFS,您需要先启用该功能:http://www.groovypost.com/howto/microsoft/enable-last-access-time-stamp-to-files-folder-windows-7/

      In the cmd prompt, Type in "fsutil behavior set disablelastaccess 0" and press enter.
      Restart your PC for changes to take affect
      

      【讨论】:

        【解决方案3】:

        通常所有文件系统都会节省文件访问时间。

        例如,看看NTFS for Windows。或者ext2,以及linux常用的旧版本文件系统。

        【讨论】:

          猜你喜欢
          • 2011-08-11
          • 2014-12-18
          • 1970-01-01
          • 1970-01-01
          • 2010-09-06
          • 2016-07-05
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多