Terminal command to write file-system attributes?

Discussion in 'Mac Programming' started by macstatic, Feb 15, 2016.

  1. macstatic, Feb 15, 2016
    Last edited: Feb 15, 2016

    macstatic macrumors 6502a

    Joined:
    Oct 21, 2005
    #1
    Is there an OSX terminal command (or one that can be installed) which allows for writing OSX file-system attributes such as the file "Creation" date (possibly also the modification date)?
    I'd like to use it in conjunction with Exiftool (for modifying file and EXIF attributes of image files) but alas it won't write the file Creation date, and apparently neither will the command xattr.
     
  2. macstatic thread starter macrumors 6502a

    Joined:
    Oct 21, 2005
    #3
    Nice!
    Could it be used together with Exiftool and have it determine the new creation date? I'm guessing as a variable though I know very little about programming.
     
  3. MacUser2525 macrumors 68000

    MacUser2525

    Joined:
    Mar 17, 2007
    Location:
    Canada
    #4
    Yes you can set that if you wish to using it. I take it you want to process the file(s) with the Exiftool then set the creation date back to the original date then once done? If so should be rather easy to do a simple bash script to read the original date store that as variable then process file(s) once done write the correct original date back to the file. According to the page below stat -f%SB -t %Y%m%d%H%M file will do it for the ctime so that read into a variable can be used to touch the ctime on the processed file at the end of processing. There are other methods shown in that answer near the bottom of the page.

    https://unix.stackexchange.com/questions/91197/how-to-find-creation-date-of-file
     
  4. macstatic thread starter macrumors 6502a

    Joined:
    Oct 21, 2005
    #5
    Yes, I want Exiftool to locate the correct date (by reading it from the photo's EXIF header), then use another tool (touch?) to actually write that date into the file "Creation" attribute.
    According to the author, Exiftool uses "mdls" which doesn't have write abilities and therefore can't write OSX file-system attributes. This is what I'm trying to find a different tool for.

    Thanks for the link and your script suggestion. I'll see what I can make out of it.
     

Share This Page