Learn how to read, extract, and format metadata for file renaming in OSX.
To rename files using metadata
seen from Canada
seen from Mexico

seen from United States
seen from Israel

seen from Dominican Republic
seen from China
seen from Israel

seen from Singapore
seen from Germany

seen from United States
seen from United States
seen from United Kingdom
seen from Senegal
seen from United States
seen from Denmark
seen from Indonesia

seen from Australia
seen from China
seen from United States
seen from China
Learn how to read, extract, and format metadata for file renaming in OSX.
To rename files using metadata
When you export photos from the Photos app the date of the file doesn't match the date the photo was taken. This is correct as the file
Script to read metadata and modify creation date in automator.
Will need to modify it to pass the date and use to change file names to reflect date photo was taken.
for f in "$@" do touch -t $(date -j -f "%Y%m%d%H%M" -v-6H $(mdls $f | grep kMDItemContentCreationDate | head -n1 | awk '{gsub("[^[:digit:]]+"," ");print $1$2$3$4$5}') +%Y%m%d%H%M) $f done
OK, found another of his videos and merged the ideas into this script In automator add run shell script and check the dropdown is at bin/zsh, not bash, and use as argument...
for f in "$@" do date_str=$(date -j -f "%Y%m%d%H%M" -v+3H $(mdls "$f" | grep kMDItemContentCreationDate | head -n1 | awk '{gsub("[^[:digit:]]+"," ");print $1$2$3$4$5}') +%Y%m%d%H%M) filename=$f:t filepath=$f:h mv $filepath/{"$filename","$date_str $filename"} done
Thanks to this dude! Video 1
And video 2
Everything else down here is pretty much mumbo jumbo... ignore
So this gets me the clean content creation date from the file in terminal
prj_seca20230222-001.jpeg | grep kMDItemContentCreationDate | head -n1 | awk '{gsub("[^[:digit:]]+"," ");print $1$2$3$4$5}'
The following will be just random notes for myself
if photo taken in Peru date -j -f "%Y%m%d%H%M" -v+3H (00-05+08) reverse the Cupertino time to 00 and then to Perú time
$( to evaluate what is inside parenthesis ) +%Y%m%d%H%M to spit it out in that format
for f in "$@" do date_str=$(date -j -f "%Y%m%d%H%M" -v+3H $(mdls "$f" | grep kMDItemContentCreationDate | head -n1 | awk '{gsub("[^[:digit:]]+"," ");print $1$2$3$4$5}') +%Y%m%d%H%M) echo "$date_str" done
to rename
for f in "$@"; do date_str=$(date -j -f "%Y%m%d%H%M" -v+3H "$(mdls "$f" | grep kMDItemContentCreationDate | head -n1 | awk '{gsub("[^[:digit:]]+"," "); print $1$2$3$4$5}') " +%Y%m%d%H%M) extension="${f##*.}" mv "$f" "${date_str}.${extension}" done
This is an example of parameter expansion in Bash shell.
The ${f##*.} syntax removes the longest matching pattern of *. (i.e., any character followed by a dot) from the beginning of the value of $f, which is a filename string. This effectively strips off the filename prefix, leaving only the file extension.
For example, if $f is my_file.txt, then ${f##*.} would evaluate to txt.
So the line extension="${f##*.}" assigns the file extension (if any) of the current file to the $extension variable.
To strip the extension and the last 3 characters from a filename, you can use parameter expansion with the ${var%pattern} syntax.
Here's an example command that removes the file extension and the last 3 characters from the filename stored in the $filename variable:
newname="${filename%.*}" newname="${newname%???}"
The first line removes the file extension (if any) from the filename by removing the shortest matching pattern of .* (i.e., a dot followed by any characters) from the end of the string.
The second line removes the last 3 characters from the filename by removing the shortest matching pattern of ??? (i.e., any 3 characters) from the end of the string.
After these two lines, the resulting $newname variable will contain the filename with the extension and last 3 characters removed.
2Code – Koshi (Song)
#NewMusic #2Code #Koshi
2Code – Koshi (Song)
2CODE DA SAVEYOR makes a return with a banging new tune titled “KOSHI”.
2CODE has been giving us good songs back to back over the years with his classic and unique sounds, and here is another song you will definitely put on repeat. ‘KOSHI’ was produced by OLUMIX.
No doubts 2CODE is an artist blessed with sounds, good lyrics and rhythm. This guy dey hot no jokes.
http://www.a…
View On WordPress