如何获得猛砸/ Debian的文件创建日期/时间? [英] How to get file creation date/time in Bash/Debian?

查看:259
本文介绍了如何获得猛砸/ Debian的文件创建日期/时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是在Debian GNU / Linux的6.0猛砸。是否有可能得到的文件创建日期/时间?不修改日期/时间。
LS -lh A.TXT 与stat -c%Y A.TXT 两者只给出修改时间。

I'm using Bash on Debian GNU/Linux 6.0. Is it possible to get the file creation date/time? Not the modification date/time. ls -lh a.txt and stat -c %y a.txt both only give the modification time.

推荐答案

不幸的是你的任务将不会在一般的可能,因为有存储每个文件由POSIX标准定义的只有3个不同的时间值(见基本定义部分4.8文件时间更新

Unfortunately your quest won't be possible in general, as there are only 3 distinct time values stored for each of your files as defined by the POSIX standard (see Base Definitions section 4.8 File Times Update)

每个文件都有三个不同的相关时间戳:最后时间
  数据访问,最后数据修改的时间,和时间的文件
  最后状态改变。这些值在文件中返回
  特征结构的结构统计,如<一个描述href=\"http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html\"><sys/stat.h>.

Each file has three distinct associated timestamps: the time of last data access, the time of last data modification, and the time the file status last changed. These values are returned in the file characteristics structure struct stat, as described in <sys/stat.h>.

编辑:如在下面的评论所提到的,这取决于所使用的元数据可以包含文件创建日期的文件系统。但要注意的信息存储一样,是非标准。取决于它可能会导致移动到另一文件系统的可移植性的问题,万一实际使用所述一个以某种方式将其存储反正。

As mentioned in the comments below, depending on the filesystem used metadata may contain file creation date. Note however storage of information like that is non standard. Depending on it may lead to portability problems moving to another filesystem, in case the one actually used somehow stores it anyways.

这篇关于如何获得猛砸/ Debian的文件创建日期/时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆