Skip to content

Latest commit

 

History

History
60 lines (42 loc) · 1.23 KB

README.md

File metadata and controls

60 lines (42 loc) · 1.23 KB

Metadater

Rename a file using its created, modified, or added date, as read from its metadata.

More Info: https://gfxhacks.com/renaming-files-by-date-from-metadata

Usage

sh metadater.sh file.ext

alternatively, make the file executable:

chmod +x metadater.sh

Then copy/move it to the /usr/local/bin directory:

sudo mv metadater.sh /usr/local/bin/metadater

If using a custom directory, make sure it's indexed in the PATH - add this line to the .bashrc config file located in the Home directory (~), if using Bash; or .zshrc if using zsh:

If the config file doesn't exist, create it first.

export PATH=$PATH:/custom/dir

Now the script can simply be run using:

metadater file.ext

Customize

Easily customize the script by adding/removing other metadata options. To list a file's metadata use:

mdls file.ext

Here are some kMDItem Date metadata options:

Common Date Attributes:

  • kMDItemContentCreationDate
  • kMDItemContentModificationDate
  • kMDItemAttributeChangeDate
  • kMDItemLastUsedDate
  • kMDItemDateAdded

Audio Date Attributes:

  • kMDItemRecordingDate

Filesystem Date Attributes:

  • kMDItemFSContentChangeDate
  • kMDItemFSCreationDate