Touch Command for setting Creation Date

Discussion in 'macOS' started by flyingscott, Jan 10, 2010.

  1. flyingscott macrumors regular

    flyingscott

    Joined:
    Nov 2, 2007
    Location:
    Michigan
    #1
    I'm using the command "touch" in the terminal to set the creation date of some old home movies I'm dumping on HD.

    I can move the creation date back with the following command:

    MacPro:~ scott$ touch -t 200308311500 /Users/scott/Desktop/2-month-bath.mov

    The problem now, I cannot move the date back up (when I fat finger)... EVEN if I move the modified date way in the future, the creation date won't move back up with it... Give the command a try on a garbage file and see what I mean.

    Any suggestions?

    I know there are other scripts and developer commands to do this, but I would really like to use this simple command if possible.
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Works fine for me? Output from my Mac below:

    robbie-duncans-macbook-pro:~ robbie$ touch me
    robbie-duncans-macbook-pro:~ robbie$ ls -l me
    -rw-r--r-- 1 robbie staff 0 10 Jan 23:34 me
    robbie-duncans-macbook-pro:~ robbie$ touch -t 200301010101 me
    robbie-duncans-macbook-pro:~ robbie$ ls -l me
    -rw-r--r-- 1 robbie staff 0 1 Jan 2003 me
    robbie-duncans-macbook-pro:~ robbie$ touch -t 201001010101 me
    robbie-duncans-macbook-pro:~ robbie$ ls -l me
    -rw-r--r-- 1 robbie staff 0 1 Jan 01:01 me

    I would note that in your example you have one to many 0 in your date/time specifier so the command will fail.
     
  3. flyingscott thread starter macrumors regular

    flyingscott

    Joined:
    Nov 2, 2007
    Location:
    Michigan
    #3
    When you do the "ls"... that is showing the modified date, not the creation date... you need to do an "mdls" command and look at the creation date.
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    OK, doing an mdls shows the creation date does not change back to 2010.
     

Share This Page