Created
September 6, 2020 11:16
-
-
Save farshidhss/d0a725c8b98900af1d59f0ada3e81ec8 to your computer and use it in GitHub Desktop.
Add filename to the title metadata for all video files in a directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/local/bin/zsh | |
| for entry in *."$1" | |
| do | |
| Filename=${entry%.*} | |
| echo "setting title -> " $Filename | |
| FileTitle=$(exiftool -s -Title "$entry" | awk '{print $3}'); | |
| echo "file title: " $FileTitle | |
| if [ "$FileTitle" = "$Filename" ]; then | |
| echo "File title is the same as filename, skipping..." | |
| else | |
| exiftool -P -overwrite_original -Title="$Filename" $entry | |
| fi | |
| done |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I suggest first open a terminal session and go to the folder where your files are stored. Then just test to see if exiftool actually runs inside your folder. If it did run then do a
chmod +x setTitleFromFilename.shto be able to execute the script then run the command./setTitleFromFilename.sh mp4