0

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?

2 Answers 2

0
  1. Get file creation date.

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

  3. set file creation date.
0

Use tar with the p(reserve) option:

 tar -x -p -v -j -f arhive.tbz
4
  • Is tar on OSX different from GNU tar? For the latter the p option is --preserve-permissions.
    – mpy
    Commented Mar 17, 2013 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
    Commented Mar 17, 2013 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
    Commented Mar 17, 2013 at 19:32

You must log in to answer this question.