Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On a Mac, When I zip and unzip files using finder or using zip/ditto from command line, I lose the creation date of the files/folders and the creation date is automatically set same as the modification date. How can I preserve the creation date?

share|improve this question

migrated from Mar 12 '13 at 14:02

This question came from our site for professional and enthusiast programmers.

  1. Get file creation date.

    • (NSDictionary *)attributesOfItemAtPath:(NSString )path error:(NSError *)error
  2. zip

  3. set file creation date.
share|improve this answer

Use tar with the p(reserve) option:

 tar -x -p -v -j -f arhive.tbz
share|improve this answer
Is tar on OSX different from GNU tar? For the latter the p option is --preserve-permissions. – mpy Mar 17 '13 at 12:07
-P preserves absolute path names and has nothing to do with time information. tar always stores owner and permission information by default, and restores it again. – Daniel Beck Mar 17 '13 at 19:29
-p tries to preserves permissions (i.e. file mode, ACLs) when restoring. It's only applicable to -x (extraction). Plain old tar cf and tar xf preserve modification times already, no additional args needed. AFAIK creation date cannot be influenced. – Daniel Beck Mar 17 '13 at 19:32

You must log in to answer this question.