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.

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 stackoverflow.com Mar 12 '13 at 14:02

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

2 Answers 2

  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
1  
-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

Your Answer

 
discard

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