Skip to content

Instantly share code, notes, and snippets.

@seth10
Created December 21, 2018 20:25
Show Gist options
  • Save seth10/cdd815d7c1bb70909fd97fef55462640 to your computer and use it in GitHub Desktop.
Save seth10/cdd815d7c1bb70909fd97fef55462640 to your computer and use it in GitHub Desktop.
A bash function to set the "Date Created" of a file to the macOS/Finder "Date Added"
SetDateCreatedToDateAdded () { SetFile -d "$(date -j -f '%Y-%m-%d %H:%M:%S' "$(mdls $1 | grep -w kMDItemDateAdded | awk '{print $3,$4}')" +"%m/%d/%Y %H:%M:%S")" $1; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment