[iTunes] Using CLI to rename every file in a folder using MediaInfo
Posted: 10 Jul 2020, 10:39
Hello,
I have a large media collection that was processed with iTunes some years ago. For some reason iTunes finds funny consolidating all episodes in a single folder. To make things better, the name format is something like "EPISODE_NUMBER EPISODE_TITLE" making a hard task to process these files with other tools.
After some time finding out why my files were renamed correctly in the UI and then when I tried to do the same in CLI it failed I was able to rename my files.
The key is that you need to use MediaInfo attributes in your format instead of using default ones like {n} and {s00e00}:
You have some other attributes that you can check in the UI. I recommend loading a file in "Edit format" -> "Change sample" so you can see available attributes.
Then if you want to process all files in a folder you can simply execute it inside a for loop:
Remember this will only work if your media has the attributes set. You can confirm using mediainfo tool or any other.
Thanks to @rednoah for pointing me at this.
I have a large media collection that was processed with iTunes some years ago. For some reason iTunes finds funny consolidating all episodes in a single folder. To make things better, the name format is something like "EPISODE_NUMBER EPISODE_TITLE" making a hard task to process these files with other tools.
After some time finding out why my files were renamed correctly in the UI and then when I tried to do the same in CLI it failed I was able to rename my files.
The key is that you need to use MediaInfo attributes in your format instead of using default ones like {n} and {s00e00}:
Code: Select all
filebot --db file -rename --format "{media.collection} {media.partID}"
Then if you want to process all files in a folder you can simply execute it inside a for loop:
Code: Select all
for i in *; do filebot --db file -rename --format "{media.collection} {media.partID}" "$i"; done
Thanks to @rednoah for pointing me at this.