How to name ebook files
Give every ebook file the author and the title, in the same order each time, and use only characters that every disk accepts. Austen, Jane - Persuasion.epub or Persuasion - Jane Austen.epub both work. What breaks a name is a character such as a colon or a question mark, a name that ends in a full stop, or a name so long that a deep folder pushes the path past a limit. A name that opens fine on one computer can still fail on a Windows PC or on a drive formatted FAT32 or exFAT.
The file name and the title inside the book are separate things, so renaming a file doesn't fix a wrong title in a reading app. Why renaming isn't enough on a Kindle explains this for MOBI files, and What metadata is inside an EPUB? shows where an EPUB keeps its title.
Nine characters to leave out
Microsoft's page on naming files, paths, and namespaces lists the reserved characters: <, >, :, ", /, \, |, ?, and *. The control characters 1 to 31 and the NUL character are out too. The exFAT specification gives the same set in its Table 35, “Invalid FileName Characters”, and says it's the set “as other FAT-based file systems”. So the list is part of the format of every drive formatted FAT32 or exFAT, not only a rule of Windows.
Book titles hit this list more often than you'd expect. Subtitles come after a colon, questions end in a question mark, and some titles quote a phrase. Replace the character rather than drop it: an underscore, a comma, or a plain hyphen keeps the words apart, so the name still reads as the title.
Two more rules from the same Microsoft page catch titles:
- Don't end a name with a space or a full stop. The page says the file system may accept it, but the Windows shell and user interface don't. A file name is safe, because its extension comes last, but a folder name has no extension. A title that ends in an ellipsis or an abbreviation breaks the rule as soon as it names a folder, for example in a layout with one folder for each book.
- Don't use a reserved device name: CON, PRN, AUX, NUL, COM1 to COM9, LPT1 to LPT9, and COM or LPT followed by a superscript ¹, ², or ³. The page adds that
NUL.txtis the same asNUL, and tells programs not to count on capitals to tell names apart, so a short book called “Con” saved asCon.epubis a name to avoid. Adding the author to the name gets round it.
That last point has a second edge. Microsoft tells programmers to treat OSCAR, Oscar, and oscar as one name, and the exFAT specification calls the file system “case insensitive and case preserving”. Two files whose names differ only in capitals count as the same name there, so they can't sit side by side in one folder of such a drive.
How long a name can be
exFAT stores a file name in up to 17 entries of 15 characters, which the specification sums up as a maximum of 255. Windows limits a whole path, folders included, to 260 characters (MAX_PATH). Since Windows 10 version 1607, Microsoft lets a registry setting or a Group Policy setting lift the limit, but only for apps that declare that they handle long paths. Every other app stops at 260, unless its programmers wrote it to use Windows' extended-length paths. A long subtitle inside an author folder inside a library folder can pass 260 before the file name itself is long. Cutting a subtitle from the file name costs nothing, because the full title lives inside the book.
Folders by author
If you keep many books, a folder for each author keeps the list short. calibre's default for sending books to a device works that way. Its template language manual gives the template, {author_sort}/{title}/{title} - {authors}, and the result for one book: Asimov, Isaac/The Foundation/The Foundation - Isaac Asimov. The author folder uses the sort form, surname first, so the folders line up by surname.
The same manual says that calibre cleans the values of a template, “replacing characters that are special to file systems with underscores, including slashes”. A slash in a title therefore can't make a folder by accident. The template of Save to disk is a separate setting: the user guide puts it under Preferences › Import/export › Saving books to disk. Where calibre keeps the books of its own library is a different question, covered in where calibre keeps your books.
The name of a book that Readwyn sends to a Kindle
When Readwyn sends a book to a Kindle that the Mac mounts as a disk (the only way it reads a Kindle, so not the Kindle Scribe or the Kindles of 2024, which don't mount), it converts the EPUB to MOBI and writes it to documents/<title> - <first author>.mobi. A book without an author becomes documents/<title>.mobi. Each of the nine reserved characters, and each control character, becomes _, and spaces and full stops at the end are trimmed. Letters of every script stay as they are, so a Tamil title keeps its Tamil name. The name stops at 200 UTF-16 units, below the 255 of the file system, which leaves room for the extension. A book with no author and an empty title is saved as documents/Untitled.mobi.
Readwyn records that path, so a later send replaces the same file even after you change the title in the library. Changing the title of a sideloaded Kindle book explains how to get the file renamed as well.