Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible under Linux to restore the file access time to that of the original file after extracting files from an archive created with tar on NTFS file system?

tar does not restore the access time even on "native" Linux file systems, so on Linux file systems I use the pax for extracting archives, which restores the access time. But on NTFS pax doesn't restore the access time. Is there a way to extract 'tar.gz' archives on NTFS file systems with restoring the original access time to the extracted files?

share|improve this question
2  
The access time on a file is so volatile that I cannot see why you would need to preserve it: surely what is important is the modification time, which tar preserves. I would expect the access time on all files to be the time when tar created the archive, so I guess you could use touch to recreate this from the modification time of the archive. The creation time will be when the tar extract was made, just as it is set on any copy of a file, which of course a tar extract is. –  AFH Jun 28 at 12:17
1  
@AFH pax, actaully, restores the access time of the original file quite good, after extracting from an archive created with tar (or with the pax, of course). I'm using the access time to find the files and packages which are not used for a long time and to decide whether they can be moved to archive or removed for freeing disk space. –  Al Berger Jun 28 at 17:28

1 Answer 1

You have to preserve the access time with tar at the moment you create your archive, option --atime-preserve

EDIT: This only preserves the access time on the original file because when tar reads files, it updates atime! You are right...

There doesn't seem to be a possibility to do this. If you need to preserve your atime, you can always use dd instead of tar, but that won't help you much on NTFS I suppose.

share|improve this answer
    
I'm using this tar's option, but it doesn't help. It seems to cause only preserving the original file's time. –  Al Berger Jun 28 at 9:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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