Skip to content

gfxhacks/metadater

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages