Renaming PDF document titles from filename
-
gcmartin
- Posts: 3
- Joined: 08 May 2015 13:59
Renaming PDF document titles from filename
I have a bunch of recipes collected from various places and stored as PDF files which I want to transfer to my e-reader but although the filename for these recipes properly describes the recipe, the document titles are quite random. Is it possible to script a batch rename for these files so that they appear correctly in my e-reader (i.e. make the document title in the metadata match the filename). Here's hoping ......
-
highend
- Posts: 14940
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Renaming PDF document titles from filename
Possible...
I don't have much time atm, so you would need Calibre (http://calibre-ebook.com/download_portable) for this script to work...
The portable version of it is enough. Install this portable version and remember it's path.
Change the first line to the path of your ebook-meta.exe!
Let's say you installed it to drive D:\
Calibre created a subfolder named "Calibre Portable" automatically, so the new path for the "$ebookMeta" variable would be:
D:\Calibre Portable\Calibre\ebook-meta.exe
After that, save the script, go to your e-book folder and select all files which titles should be changed. Make backups first and try it with e.g. two of them. If it works, fine, do it for all others.
If you find a better command line utility that writes title metadata into different ebook formats... Let me know.
I don't have much time atm, so you would need Calibre (http://calibre-ebook.com/download_portable) for this script to work...
The portable version of it is enough. Install this portable version and remember it's path.
Code: Select all
$ebookMeta = "D:\Users\Highend\Tools\Calibre\Calibre\ebook-meta.exe";
$files = get("SelectedItemsPathNames", "|");
foreach($file, $files) {
$baseName = getpathcomponent($file, "base");
if ($baseName) {
run """$ebookMeta"" ""$file"" --title=""$baseName""", , 1, 1;
}
}
Let's say you installed it to drive D:\
Calibre created a subfolder named "Calibre Portable" automatically, so the new path for the "$ebookMeta" variable would be:
D:\Calibre Portable\Calibre\ebook-meta.exe
After that, save the script, go to your e-book folder and select all files which titles should be changed. Make backups first and try it with e.g. two of them. If it works, fine, do it for all others.
If you find a better command line utility that writes title metadata into different ebook formats... Let me know.
One of my scripts helped you out? Please donate via Paypal
-
gcmartin
- Posts: 3
- Joined: 08 May 2015 13:59
Re: Renaming PDF document titles from filename
Thanks for a quick reply - I'll try it out and see how it goes 
-
gcmartin
- Posts: 3
- Joined: 08 May 2015 13:59
Re: Renaming PDF document titles from filename
Perfect! I hadn't discovered ebook-meta in Calibre.
http://manual.calibre-ebook.com/cli/ebook-meta.html
Very useful as it obviously it opens up several possibilities for renaming PDF's as well as other e-books.
Many thanks.
http://manual.calibre-ebook.com/cli/ebook-meta.html
Very useful as it obviously it opens up several possibilities for renaming PDF's as well as other e-books.
Many thanks.
XYplorer Beta Club