使用 tar 创建 tar 存档时-c,修改时间似乎在变化,特别是它截断了小数点后的时间,使 modtime 只是它原来的整数值。
注意:```
[localhost] $ mkdir test
[localhost] $ stat test
File: ‘test’
Size: 4096 Blocks: 8 IO Block: 4096 directory
Modify: 2016-07-18 17:01:33.116807520 -0400 # <------ Notice exact time
[localhost] $ tar -cf test.tar test
[localhost] $ tar -xf test.tar
[localhost] $ stat test
File: ‘test’
Size: 4096 Blocks: 8 IO Block: 4096 directory
Modify: 2016-07-18 17:01:33.000000000 -0400 # <------ Notice how time is rounded
Run Code Online (Sandbox Code Playgroud)
(stat为了可读性,我从输出中删除了不相关的部分)
我已经询问过man tar,但找不到可以以纳秒为单位保留 …
在golang中使用archive/tar包,似乎无法访问文件所具有的硬链接数.但是,我记得在某个地方读取tar目录或文件可以保留硬链接.
是否有一些包可以帮助我做到这一点?