Can we instruct tar to do not keep modified time of the files in archive file while compress.

What I want is, the extracted directories/files should get time from machine where it's extracting, not from the archive file. But I want to get it done in compression part, not in extraction part with -m.

  • 1
    You can use --mtime to force the stored mtimes to a specific value. I don't think there's an option to avoid storing it altogether.
    – Tom Hunt
    Sep 3 '15 at 21:27
  • tarhas no option --mtimeIf you refer to vendor specific options, you should mention which vendor specific implementation you refer to.
    – schily
    Sep 4 '15 at 12:48

tar always stores the modification time of the files it puts into the archive.

If you like to get the current time of extraction while extracting the archive, the only way to achieve this is to use

tar xm < xxx.tar

at extraction time.

  • Thanks for answer @schily. So I understand it's not possible on compression part and possible only on extraction part.
    – Pratheeban
    Sep 5 '15 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.