How to alter the creation date of a file.

Discussion in 'macOS' started by AppleMatt, Apr 21, 2009.

  1. AppleMatt macrumors 68000

    AppleMatt

    Joined:
    Mar 17, 2003
    Location:
    UK
    #1
    Hi,

    I can't seem to find a way to alter the creation date of a file. I have a project and mid-way through I copied everything into a new file to test something out. It's in a different format so it's impossible to simply port it back to the original file.

    How can I alter the file properties to reflect the date I want? There must be a Terminal command to do it.

    AppleMatt
     
  2. Jethryn Freyman macrumors 68020

    Jethryn Freyman

    Joined:
    Aug 9, 2007
    Location:
    Australia
    #2
    Probably, google may be able to help.

    I needed to adjust the date on a single file once, so I set the computer clock to the specific date and time, re-saved it, then changed the clock back.
     
  3. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #3
    Install the OSX Developer Tools (if you haven't got them you can download from developer.apple.com, create a free developer account if you need one). Then use the SetFile command line utility. You need to use the -d switch to set the creation date.
     
  4. Dunmail macrumors regular

    Joined:
    Mar 27, 2009
    Location:
    Skipton, UK
    #4
    touch -t 200904211357 <filename>

    -t is timestamp format is [[CC]YY]MMDDhhmm[.ss]

    So Century, Year and seconds are optional
     
  5. AppleMatt thread starter macrumors 68000

    AppleMatt

    Joined:
    Mar 17, 2003
    Location:
    UK
    #5
    Fantastic, problem solved.

    Thanks to you both :)

    AppleMatt
     
  6. Jethryn Freyman macrumors 68020

    Jethryn Freyman

    Joined:
    Aug 9, 2007
    Location:
    Australia
    #6
    Excellent, thanks also. I was hoping there was an easier way to do that.
     

Share This Page