Home
Add Filename custom column to Calibre
Calibre (filename) Tuesday, 07 January 2014 by paul

Calibre

Calibre is an excellent free application for storing ebooks in an electronic library and converting their format between mobi/epub/pdf/docx etc for your e-reader.

To add a custom column to the view to display the filename of the books entry follow the instructions below.

  1. Right click on header of coloumns and select "Add your own columns"
  2. Press the "Add custom column" button
  3. Enter Lookup name "filename"
  4. Enter Column heading "Filename"
  5. Select Column built from other columns
  6. Enter Template as "{:'re(formats_paths(),'.+[\\]','')'}"
  7. Leave other options as default and press OK
  8. Restart Calibre when prompted

The new column should now be displayed.


Add Comment
Friday, 23 August 2024 by Mike
Ah so I figured it out. The problem is a mismatch between Calibre's save to disk settings and the column view settings. I want {author_sort} - {title} on both so that the column actually displays the precise filename that is exported. However, after matching these two I still had an issue with a mismatch. Even though the save to disk save template was explictly defined as {author_sort} - {title}, it was saving {author_sort} - {title_sort}. The solution was to go to preferences, tweaks, Control sorting of titles and series, and Edit tweak by defining title_series_sorting = 'strictly_alphabetic'. Then, bulk edit metadata with 'Update title sort'. The result is a nice column labeled "filename for export" showing "Asimov, Isaac - The Last Question.epub" and when I save the file to disk, the filename also reads "Asimov, Isaac - The Last Question.epub" . I hope this helps someone because that took a couple hours to figure out. Ridiculous.
Friday, 23 August 2024 by Mike
corrected and clarified: --the actual filename of my *imported* book is "Asimov, Isaac - Last Question, The.epub" --after import, Calibre does save the book locally in its own weird file structure as "The Last Question - Isaac Asimov.epub" --your code shows "The Last Question - Isaac Asimov.epub" in the column --upon export, (save to disk) Calibre exports "Asimov, Isaac - Last Question, The.epub" --I need a way to put "Asimov, Isaac - Last Question, The.epub" in a column in Calibre
Friday, 23 August 2024 by Mike
This is great, almost. Unfortunately it appears to change the filename to "TITLE - AUTHOR-FIRST-NAME AUTHOR-LAST-NAME". For instance, your code produces "The Last Question - Isaac Asimov.epub" but the actual filename of my *imported* book is "Asimov, Isaac - Last Question, The.epub". After import, Calibre does save the book locally in its own weird file structure as "The Last Question - Isaac Asimov.epub". But then if I export (save to disk) the book after editing metadata in Calibre, it again exports "The Last Question - Isaac Asimov.epub". This is a long way of saying: I need to be able to parse the actual SOURCE filename of the epub. Is that possible?
Friday, 18 March 2016 by Tom S.
Fantastic! I was hoping to figure out a way to display ONLY the relative path, without the library path ( {:'current_library_path()'} ) or filename ( {:'re(formats_paths(),'.+[\\]','')'} ). It seemed like it would not be too difficult, but has me stumped. This would greatly help me sort out many duplicate folders that have crept into my Calibre Library PATH, but are NOT actually duplicated in the database itself. Yes, I know about the excellent Duplicate Finder extension, but that is not my problem.
Tuesday, 10 March 2015 by fuzzy
thanks, worked nicely
Saturday, 18 January 2014 by Paul
Hi Joseph, If the ebook is in a container like a zip the it displays the containers filename. Try the same with the formula {:'formats_paths()'} which will show the full path.
Wednesday, 15 January 2014 by Joseph
Hi Paul. Thanks for the excellent post as I've been trying to figure out a way to accomplish this in Calibre for months. One question. I followed your instructions exactly and I still could not get the filename to appear in the newly created column but instead got a different derivative of the title plus the filename extension. I'm sure I followed your instructions and copied-and-pasted your code so I wonder if there is a character or two off in the code? Thank you.