- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在寻找一种在不同文件系统上使用旧 ctime 创建文件的方法。在 Linux ext 上,这是通过使用
触摸/path/to/file
debugfs -w -R 'set_inode_field/path/to/file ctime 201001010101'/dev/sdX
echo 3 >/proc/sys/vm/drop_caches
在 FreeBSD 的 UFS 上是否有任何等价物?甚至可能在 MacOSX HFS+ 上?
最佳答案
在 FreeBSD 上,touch使用 -f
选项的命令可能适用于此,例如:
touch -t 0510242022.13 file
将日期设置为 2005 年 11 月 24 日 20:22:13
格式为[[CC]YY]MMDDhhmm[.SS]
,来自man touch
:
-t Change the access and modification times to the specified time
instead of the current time of day. The argument is of the form
``[[CC]YY]MMDDhhmm[.SS]'' where each pair of letters represents
the following:
CC The first two digits of the year (the century).
YY The second two digits of the year. If ``YY'' is
specified, but ``CC'' is not, a value for ``YY''
between 69 and 99 results in a ``CC'' value of 19.
Otherwise, a ``CC'' value of 20 is used.
MM The month of the year, from 01 to 12.
DD the day of the month, from 01 to 31.
hh The hour of the day, from 00 to 23.
mm The minute of the hour, from 00 to 59.
SS The second of the minute, from 00 to 61.
要更改 ctime,您可以使用 fsdb ,您可能需要以单一模式启动以使磁盘处于只读模式,例如:
> fsdb /dev/vtbd0p2
** /dev/vtbd0p2 (NO WRITE)
Editing file system `/dev/vtbd0p2'
Last Mounted on /
current inode: directory
I=2 MODE=40755 SIZE=1024
BTIME=Sep 29 01:45:50 2016 [0 nsec]
MTIME=Nov 26 09:47:37 2016 [339135000 nsec]
CTIME=Nov 26 09:47:37 2016 [339135000 nsec]
ATIME=Nov 26 09:28:38 2016 [679268000 nsec]
OWNER=root GRP=wheel LINKCNT=20 FLAGS=0 BLKCNT=8 GEN=37b9b524
fsdb (inum: 2)>
从那里我可以 cd 到目录然后选择它:
fsdb (inum: 2)> cd /usr/home/nbari
和
fsdb (inum: 644816)> lookup file
您可以键入active
来仔细检查文件,例如:
fsdb (inum: 642101)> active
current inode: regular file
I=642101 MODE=100644 SIZE=29
BTIME=Oct 24 20:22:13 2005 [0 nsec]
MTIME=Jan 1 12:12:12 2012 [0 nsec]
CTIME=Jan 1 12:12:12 2012 [0 nsec]
ATIME=Jan 1 12:12:12 2012 [0 nsec]
OWNER=nbari GRP=nbari LINKCNT=1 FLAGS=0 BLKCNT=8 GEN=384445f7
然后只需将 ctime 更改为您想要的日期:
fsdb (inum: 642101)> ctime 20121212010101
格式为YYYYMMDDHHMMSS[.nsec]
然后通过键入 q
或 exit
退出,再次检查运行 stat
,示例:
> stat -x test_file
File: "test_file"
Size: 29 FileType: Regular File
Mode: (0644/-rw-r--r--) Uid: ( 1002/ nbari) Gid: ( 1002/ nbari)
Device: 0,68 Inode: 642101 Links: 1
Access: Sun Jan 1 12:12:12 2012
Modify: Sun Jan 1 12:12:12 2012
Change: Sun Jan 1 12:12:12 2012
关于linux - 在 FreeBSD UFS/MacOS X HFS 下更改文件的 ctime,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40751290/
我正在使用 jar -uf 来更新我的 MANIFEST.MF 文件,如下所示: a. jar xf jarfile.jar META-INF\MANIFEST.MF b.编辑文件 c. jar uf
好的,我已经使用 Solaris 10 多年了,从来没有见过这个...... 我有一个目录列表,其中包含同名的文件和子目录: -rw-r--r-- 1 root other 1592
我遇到了术语“straightforward uf”来描述以下 facebook 工程难题的解决方案(算法?):liarliar .有谁知道这是什么意思吗? 最佳答案 也许联合发现? http://w
我有一个未知类型的 UFS 分区。我想知道它来自 Linux 的 UFS 是什么类型(可能是任何一种)。有没有适用于 Linux 的工具(库)或方法可以解决我的问题。我知道我可以尝试安装所有类型,但这
/* 180 * Create a regular file 181 */ 182 static int 183 ufs_create(ap) 184 stru
我正在寻找一种在不同文件系统上使用旧 ctime 创建文件的方法。在 Linux ext 上,这是通过使用 触摸/path/to/file debugfs -w -R 'set_inode_field
我是一名优秀的程序员,十分优秀!