8

I tried the -X switch on zip, but that did not save the date created attribute. I can get it using this method. When a file is added to a zip archive using 7-Zip, it preserves the date created and date accessed attributes. I would like to do the same on Linux and then extract my files on Windows, while preserving the date created.

  • 1
    If possible, change your filesystem for backup system – PersianGulf Sep 01 '13 at 21:54
  • Have you tried using 7-zip? It is not a Windows-specific program. Also, does your filesystem keep a record of the date created? Many do not. – terdon Sep 01 '13 at 22:06
  • It's typically called 7z in unix. – slm Sep 01 '13 at 22:09
  • I'm not sure I'd expect anything from the -X switch either. I think it's to include/exclude the extended attributes related to ACL. – slm Sep 01 '13 at 22:10
  • 1
    @slm also, as far as I know, ext filesystems do not store the creation date, only the modification data so this might not be possible if the files are coming from ext. – terdon Sep 01 '13 at 22:33
  • @terdon Ah, I assumed that zip was 7z, I'll go install it and try again. I added a link to my first question where I can now get the date created for NTFS-3G and it does work. The files are definitely on an NTFS-3G partition (shows them as root:root with 777 permissions). – NobleUplift Sep 02 '13 at 00:42
  • OK, since you said "... on Linux and extract on Windows" I thought you were copying from a Linux filesystem to NTFS. – terdon Sep 02 '13 at 00:44
  • You might want to try using bsdtar instead of the usual GNU tar. It can save extended file attributes, and it does save a creation time when used with *BSD filesystems. – wingedsubmariner Sep 02 '13 at 02:31

1 Answers1

1

You could safe the times in a separate file:

(cd /path/to/ntfs/fs && getfattr -n system.ntfs_times -R .) > times

And to restore the times:

(cd /path/to/ntfs/fs && setfattr --recover=-) < times