L
L
Lilumi2012-11-11 23:23:43
linux
Lilumi, 2012-11-11 23:23:43

Is it possible to create a tar archive that would store the creation/modification dates of a file?

Hello.
Interested in how to create an archive on a hosting that would save all the dates of creation/modification of files? And then I try to create tar.gz and as a result in the archive I see the date and time when these files were added to the archive, and when unpacking, the time when the files were created/modified becomes the current time (that is, the time when this archive was unpacked.)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
jcmvbkbc, 2012-11-12
@jcmvbkbc

They are already stored there, see for example www.fileformat.info/format/tar/corion.htm
mtime is the last modification time of the file at the time of its archiving.
If you look at the hexdump of an unpacked archive, you can see this field:

00000000  2e 67 69 74 69 67 6e 6f  72 65 00 00 00 00 00 00  |.gitignore......|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000040  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000060  00 00 00 00 30 30 30 30  36 36 34 00 30 30 30 30  |....0000664.0000|
00000070  37 36 34 00 30 30 30 30  37 36 34 00 30 30 30 30  |764.0000764.0000|
00000080  30 30 30 30 30 30 30 00  31 32 30 34 33 37 30 32  |0000000.12043702|
00000090  36 37 36 00 30 31 33 32  30 31 00 20 30 00 00 00  |676.013201. 0...|
...

12043702676 is it.

A
Alukardd, 2012-11-12
@Alukardd

GNU/Linux does not store creation dates for files.
Date of modification and so should not change from packing / unpacking.
The access date can be saved - --atime-preserve.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question