Answers.Body: <p><a href="http://www.sno.phy.queensu.ca/~phil/exiftool/" rel="noreferrer">exiftool</a> can read (but not write) epub meta data. For example</p>
  
  <blockquote>
    <p>exiftool -T -Title main.epub</p>
  </blockquote>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-14T17:34:38.527Z
Answers.Text: This is actually an excellent answer, which furthermore works also for mobi or PDF (though the metadata info in PDF is not always very informative). It will list complete metadata if the desired one is not specified: **exiftool main.epub**. If I had not already voted for an answer which helped me a lot, I would choose you as best answer (I know I can change).
Answers.UserDisplayName: babou
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-06T16:03:56.353Z
Answers.LastActivityDate: 2017-06-06T16:03:56.353Z
Answers.UserDisplayName: pheon
Answers.Body: <p>An EPUB file is just a zip file, and the book's metadata is contained in the OPF (Open Packaging Format) file, which is an XML file. The title is located in the /package/metadata/dc:title element. The other info you're looking for is probably also in children of the metadata element. Here's a good intro to the EPUB format: <a href="http://www.ibm.com/developerworks/xml/tutorials/x-epubtut/">http://www.ibm.com/developerworks/xml/tutorials/x-epubtut/</a>.</p>
  
  <p>I'm not very familiar with Linux, so I don't know exactly how you'd do all this from the command line. I suspect it would involve writing or finding a script that would uncompress or dig around in the EPUB file, find the OPF file, parse its XML, and locate the element with the metadata you specify, perhaps using XPath.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-28T19:33:16.773Z
Answers.Text: Thanks for the pointers. Actually, I was looking for a solution that does a minimal amount of computation. I was going to try it based on your answer, but the next answer seems to do the job.
Answers.UserDisplayName: babou
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-28T14:04:52.197Z
Answers.LastActivityDate: 2016-03-28T14:04:52.197Z
Answers.UserDisplayName: thinkulum
Answers.Body: <p>To print out epub metadata,</p>
  
  <pre><code>exiftool yourbook.epub
  </code></pre>
  
  <p>To edit the metadata, you'd need to unzip it and then zip it back again, as mentioned by others, epub is just a zip file</p>
  
  <pre><code>mkdir tempfolder
  mv yourbook.epub tempfolder
  cd tempfolder
  unzip yourbook.epub
  mv yourbook.epub ../youroldbook.epub
  </code></pre>
  
  <p>Find and edit the metadata in <code>opf</code> file</p>
  
  <pre><code>find . -iname '*.opf'
  </code></pre>
  
  <p>Metadata would most probably be in the <code>&lt;dc:title&gt;</code> tag,</p>
  
  <pre><code>&lt;dc:title id="pub-title"&gt;TITLE OF YOUR BOOK&lt;/dc:title&gt;
  </code></pre>
  
  <p><code>zip</code> it after editing</p>
  
  <pre><code>zip -rX ../YOUR_BOOK.epub mimetype META-INF/ .
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-22T02:37:17.237Z
Answers.LastActivityDate: 2019-06-13T02:03:17.780Z
Answers.LastEditDate: 2019-06-13T02:03:17.780Z
Answers.UserDisplayName: GypsyCosmonaut
Answers.Body: <h1>with Calibre's <a href="https://manual.calibre-ebook.com/generated/en/ebook-meta.html" rel="nofollow noreferrer">ebook-meta</a></h1>
  <p>Example output of <code>ebook-meta unixpowertools.epub</code>:</p>
  <pre><code>Title               : UNIX Power Tools, 3rd Edition
  Author(s)           : Jerry Peek, Shelley Powers, Tim O’Reilly &amp; Mike Loukides [Jerry Peek, Shelley Powers, Tim O’Reilly, and Mike Loukides]
  Publisher           : O’Reilly Media
  Tags                : COMPUTERS / Operating Systems / UNIX
  Languages           : eng
  Published           : 2009-02-08T23:00:00+00:00
  Rights              : Copyright © 2009 O’Reilly Media, Inc.
  Identifiers         : isbn:9780596103699
  Comments            : &lt;p&gt;The latest edition of this best-selling favorite is loaded with vital information on Linux, Darwin, and BSD. &lt;i&gt;Unix Power Tools&lt;/i&gt; 3rd Edition now offers more coverage of bash, zsh, and other new shells, along with discussions about modern utilities and applications. Several sections focus on security and Internet access. There is a new chapter on access to Unix from Windows, and expanded coverage of software installation and packaging, as well as basic information on Perl and Python.&lt;/p&gt;
  </code></pre>
  <p>We can use <a href="https://www.man7.org/linux/man-pages/man1/awk.1p.html" rel="nofollow noreferrer"><code>awk</code></a> to get the title only:</p>
  <pre><code>ebook-meta unixpowertools.epub | awk -F &quot;^Title +: &quot; 'NF &gt; 1 {print $2}'
  </code></pre>
  <p>For the example file above, this produces:</p>
  <blockquote>
  <p>UNIX Power Tools, 3rd Edition</p>
  </blockquote>
  <p>Some ebooks contain the &quot;Title sort&quot; field, which this command doesn't extract but might be relevant to you.</p>
  <h2>Explanation of the command</h2>
  <ul>
  <li><code>awk -F &quot;^Title +: </code> sets <code>awk</code>'s separator to &quot;Title&quot; (which has to be at the start of a line due to the <code>^</code> anchor), followed by at least one whitespace followed by a colon and space.</li>
  <li><code>NF &gt; 1</code> will skip empty lines, where no separator was found</li>
  <li><code>{print $2}</code> prints the second colon which is the text after the string matched by <code>^Title +: </code></li>
  </ul>
  <p><a href="https://stackoverflow.com/questions/11673287/how-to-remove-a-word-prefix-using-grep/56236273#56236273">Here</a> are more ways to get the string after a prefix, using regular expressions.</p>
  <h2>Supported ebook formats</h2>
  <p>Regarding the supported file formats, I quote from the <a href="https://manual.calibre-ebook.com/generated/en/ebook-meta.html" rel="nofollow noreferrer">manual</a>:</p>
  <blockquote>
  <p>Supported formats for reading metadata: azw, azw1, azw3, azw4, cbr, cbz, chm, docx, epub, fb2, fbz, html, htmlz, imp, lit, lrf, lrx, mobi, odt, oebzip, opf, pdb, pdf, pml, pmlz, pobi, prc, rar, rb, rtf, snb, tpz, txt, txtz, updb, zip</p>
  <p>Supported formats for writing metadata: azw, azw1, azw3, azw4, docx, epub, fb2, fbz, htmlz, lrf, mobi, odt, pdb, pdf, prc, rtf, tpz, txtz</p>
  </blockquote>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-11T18:41:50.233Z
Answers.LastActivityDate: 2023-01-27T06:28:38.893Z
Answers.LastEditDate: 2023-01-27T06:28:38.893Z
Answers.UserDisplayName: Matthias Braun
Answers.Body: <p>Ok, so since nobody has ANY info on this online and this is the top search results. Here is what you are looking for. <code>exiftool -a -u -g1 nameofthe.epub</code>. This line gives you a giant output of all the metadata tags you can extract using exiftool. <code>exiftool -t -Title -Creator -PublicationDate -CreatorFile-as nameofthe.epub</code> this is how you use it. If you push <code>-t</code> lowercase it shows you the description of the tags you pulled. If you run <code>-T</code> uppercase, it just shows the tags. Your welcome. Enjoy.</p>
  <p>Edit: Also, since exiftool is a GIANT PITA and their help is semi useless. Here is a few scripts I wrote for it that might help someone out. This took me forever... These are formatted for batch files with <code>%%</code> and <code>&quot;</code>. You may need to edit</p>
  <p>This moves any epubs in folder DIR into folders sorted by their Creator (Author).</p>
  <pre><code>for %%f in (DIR\*.epubs) do (exiftool &quot;%%f&quot; &quot;-Directory&lt;Creator&quot;)
  </code></pre>
  <p>This renames any epubs in a folder, to the Title and Author</p>
  <pre><code>for %%f in (01-input\*.epub) do (exiftool &quot;-filename&lt;$title - $creator.%%e&quot; &quot;%%f&quot;)
  </code></pre>
  <p>To make them recursive into subdirectories you need to change the <code>for</code> formatting. Example</p>
  <pre><code>for /R &quot;01-input&quot; %%f in (*.epub) do (exiftool &quot;-filename&lt;$title - $creator.%%e&quot; &quot;%%f&quot;)
  </code></pre>
  <p>Edit2: On the off chance your tags contain &quot;illegal&quot; characters, outlined here (<a href="https://exiftool.org/filename.html" rel="nofollow noreferrer">https://exiftool.org/filename.html</a>), place the tag inside <code>{}</code> and put a <code>;</code> at the end of the tag. This strips those out so it works. Example script.</p>
  <pre><code>for /R &quot;01-input&quot; %%f in (*.epub) do (exiftool &quot;-filename&lt;${title;} - ${creator;}.%%e&quot; &quot;%%f&quot;)
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-12T00:37:09.103Z
Answers.LastActivityDate: 2020-09-12T12:47:56.753Z
Answers.LastEditDate: 2020-09-12T12:47:56.753Z
Answers.UserDisplayName: SuperMar1o
Answers.Body: <p>Expounding on @pheon's answer, I created this shell script</p>
  
  <pre><code>#!/bin/bash
  
  exiftool="/usr/local/bin/exiftool"
  
  filename=$(basename "$1")
  extension="${filename##*.}"
  filename="${filename%.*}"
  directory=$(dirname "$1")
  newfilename=`${exiftool} -T -Title $1`
  
  echo mv "$1" "${directory}/${newfilename}.${extension}"
  mv "$1" "${directory}/${newfilename}.${extension}"
  </code></pre>
  
  <p>Just run the script, passing the pub filename and it will rename it in-place to be the title of the eBook.  Note that it is likely there will be spaces in the filename.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-24T11:56:03.707Z
Answers.LastActivityDate: 2017-09-24T11:56:03.707Z
Answers.UserDisplayName: Paul Waldo
Answers.Body: <p>Here's a quick bash script (with no error-checking whatsoever) to do what you want:</p>
  
  <pre><code>#!/bin/bash
  #
  if [ $# -lt 3 ]
  then
     echo
     echo "Usage: minfo -m &lt;meta-type&gt; &lt;epub-file&gt;"
     echo
  else
     fileloc=`unzip -l "$3" | grep -Po '\b[^\s-]*\.opf\b'`
     metafound=`zipgrep  '&lt;dc:'$2'&gt;(.*)&lt;/dc:'$2'&gt;' "$3" $fileloc`
     echo `expr "$metafound" : '.*&lt;dc:'$2'&gt;\(.*\)&lt;/dc:'$2'&gt;.*'`
  fi
  </code></pre>
  
  <p>This uses <code>unzip -l</code> to find out where the <code>.opf</code> file is in the <code>.epub</code> (normally <code>OEBPS\content.opf</code>, but it can be named anything as long as it has the <code>.opf</code> extension).  Then it uses <code>zipgrep</code> to find occurrences of the desired metadata type in that file. Finally, strip off the tags to leave just the metadata.</p>
  
  <p>And here's a test run:</p>
  
  <pre><code>beaker$ ./minfo -m title Make_Electronics.epub 
  Make: Electronics
  beaker$ ./minfo -m publisher Make_Electronics.epub 
  O'Reilly Media, Inc.
  beaker$ ./minfo -m subject Make_Electronics.epub 
  
  beaker$
  </code></pre>
  
  <p>That last line is blank because the metadata entry for <code>subject</code> in the opf file is:</p>
  
  <pre><code>&lt;dc:subject/&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-28T20:46:16.483Z
Answers.Text: Very nice. Pretty-much what I wanted.  I was checking your code and
  wanted to ask you about the part you just changed (xxx.opf), as it
  looked a bit strange. I did not know zipgrep. I slightly changed your
  script to have less problems with `exit` depending on how the script
  is used. Another point: when several meta fields with differing
  values, the script returns the last one. Also, some meta fileds seem
  to have a more complicated structure: `<dc:creator opf:role="aut">John
  Doe</dc:creator>`. Then I checked only one epub file.  But I learned a bunch of things on dealing with such problems.
Answers.UserDisplayName: babou
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-28T21:07:08.483Z
Answers.Text: @babou Good edit, thanks. I can modify the regex to handle the case you bring up of the `<dc:creator...` if you like. Meanwhile I'll have a look at returning multiple values.
Answers.UserDisplayName: beaker
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-28T21:24:47.437Z
Answers.Text: Would be great. But I reached my available limit for rep brownie points :-). Then do not spend too much time on it, as there will always more that is asked.  I am only surprised the is no standard set of functions for simple manipulation of epub. I am only interested in what does not carry DRM, and I am not even sure it matters much for the rest.
Answers.UserDisplayName: babou
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-13T18:14:37.927Z
Answers.Text: What is the "-Po" argument?  OS X grey has no -P :-(
Answers.UserDisplayName: Paul Waldo
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-13T18:21:29.443Z
Answers.Text: @PaulWaldo See https://stackoverflow.com/questions/16658333/grep-p-no-longer-works-how-can-i-rewrite-my-searches
Answers.UserDisplayName: beaker
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-05T21:04:48.063Z
Answers.Text: The first comment mentioned more complicated tags.  I modified the `<dc:'$2'>` to `<dc:'$2'.*>` in both the `metafound` and `echo` lines to handle that.
Answers.UserDisplayName: Mike
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-28T17:41:59.830Z
Answers.LastActivityDate: 2016-03-28T21:57:14.693Z
Answers.LastEditDate: 2016-03-28T21:57:14.693Z
Answers.UserDisplayName: beaker
Body: <p>I would like to use a command line program to extract the title of a book
  (possibly also other metadata) from its epub file and return it as a
  string.</p>
  <p>I am using Linux, but my guess is that the question makes sense in other
  environments, too.</p>
  <p>I expected to easily find a clear and simple answer by searching
  the web. But apparently that is not the case, or I am still too
  ignorant to recognize answers.</p>
  <p>The command could look like this</p>
  <pre><code>getbookinfo -m title myfile.epub
  </code></pre>
  <p>and would yield the title of the book found in the epub file.</p>
  
Tags: <epub><editing><metadata><linux>
Title: Command line extraction of metadata (title. author) from epub file
UserDisplayName: babou
ThreadText: # Command line extraction of metadata (title. author) from epub file
  
  (Asked by: username_0 on 2016-03-27)
  
  I would like to use a command line program to extract the title of a book
  (possibly also other metadata) from its epub file and return it as a
  string.
  
  I am using Linux, but my guess is that the question makes sense in other
  environments, too.
  
  I expected to easily find a clear and simple answer by searching
  the web. But apparently that is not the case, or I am still too
  ignorant to recognize answers.
  
  The command could look like this
  
  ```
  getbookinfo -m title myfile.epub
  
  ```
  
  and would yield the title of the book found in the epub file.
  
  **Tags:** epub, editing, metadata, linux
  
  
  ---
  
  ## 7 answers
  
  ### Answer by username_7 on 2016-03-28. Score: 14 | Accepted answer
  
  Here's a quick bash script (with no error-checking whatsoever) to do what you want:
  
  ```
  #!/bin/bash
  #
  if [ $# -lt 3 ]
  then
     echo
     echo "Usage: minfo -m <meta-type> <epub-file>"
     echo
  else
     fileloc=`unzip -l "$3" | grep -Po '\b[^\s-]*\.opf\b'`
     metafound=`zipgrep  '<dc:'$2'>(.*)</dc:'$2'>' "$3" $fileloc`
     echo `expr "$metafound" : '.*<dc:'$2'>\(.*\)</dc:'$2'>.*'`
  fi
  
  ```
  
  This uses `unzip -l` to find out where the `.opf` file is in the `.epub` (normally `OEBPS\content.opf`, but it can be named anything as long as it has the `.opf` extension). Then it uses `zipgrep` to find occurrences of the desired metadata type in that file. Finally, strip off the tags to leave just the metadata.
  
  And here's a test run:
  
  ```
  username_7$ ./minfo -m title Make_Electronics.epub 
  Make: Electronics
  username_7$ ./minfo -m publisher Make_Electronics.epub 
  O'Reilly Media, Inc.
  username_7$ ./minfo -m subject Make_Electronics.epub 
  
  username_7$
  
  ```
  
  That last line is blank because the metadata entry for `subject` in the opf file is:
  
  ```
  <dc:subject/>
  
  ```
  
  > **Comments:**
  > **username_0**: Very nice. Pretty-much what I wanted.  I was checking your code and wanted to ask you about the part you just changed (xxx.opf), as it looked a bit strange. I did not know zipgrep. I slightly changed your script to have less problems with `exit` depending on how the script is used. Another point: when several meta fields with differing values, the script returns the last one. Also, some meta fileds seem to have a more complicated structure: `<dc:creator opf:role="aut">John Doe</dc:creator>`. Then I checked only one epub file.  But I learned a bunch of things on dealing with such problems.  
  > **username_7**: @username_0 Good edit, thanks. I can modify the regex to handle the case you bring up of the `<dc:creator...` if you like. Meanwhile I'll have a look at returning multiple values.  
  > **username_0**: Would be great. But I reached my available limit for rep brownie points :-). Then do not spend too much time on it, as there will always more that is asked.  I am only surprised the is no standard set of functions for simple manipulation of epub. I am only interested in what does not carry DRM, and I am not even sure it matters much for the rest.  
  > **username_6**: What is the "-Po" argument?  OS X grey has no -P :-(  
  > **username_7**: @username_6 See https://stackoverflow.com/questions/16658333/grep-p-no-longer-works-how-can-i-rewrite-my-searches  
  > **username_8**: The first comment mentioned more complicated tags.  I modified the `<dc:'$2'>` to `<dc:'$2'.*>` in both the `metafound` and `echo` lines to handle that.  
  
  ---
  
  ### Answer by username_1 on 2017-06-06. Score: 16
  
  [exiftool](http://www.sno.phy.queensu.ca/~phil/exiftool/) can read (but not write) epub meta data. For example
  
  > exiftool -T -Title main.epub
  
  > **Comments:**
  > **username_0**: This is actually an excellent answer, which furthermore works also for mobi or PDF (though the metadata info in PDF is not always very informative). It will list complete metadata if the desired one is not specified: **exiftool main.epub**. If I had not already voted for an answer which helped me a lot, I would choose you as best answer (I know I can change).  
  
  ---
  
  ### Answer by username_2 on 2016-03-28. Score: 7
  
  An EPUB file is just a zip file, and the book's metadata is contained in the OPF (Open Packaging Format) file, which is an XML file. The title is located in the /package/metadata/dc:title element. The other info you're looking for is probably also in children of the metadata element. Here's a good intro to the EPUB format: <http://www.ibm.com/developerworks/xml/tutorials/x-epubtut/>.
  
  I'm not very familiar with Linux, so I don't know exactly how you'd do all this from the command line. I suspect it would involve writing or finding a script that would uncompress or dig around in the EPUB file, find the OPF file, parse its XML, and locate the element with the metadata you specify, perhaps using XPath.
  
  > **Comments:**
  > **username_0**: Thanks for the pointers. Actually, I was looking for a solution that does a minimal amount of computation. I was going to try it based on your answer, but the next answer seems to do the job.  
  
  ---
  
  ### Answer by username_3 on 2019-05-22. Score: 4
  
  To print out epub metadata,
  
  ```
  exiftool yourbook.epub
  
  ```
  
  To edit the metadata, you'd need to unzip it and then zip it back again, as mentioned by others, epub is just a zip file
  
  ```
  mkdir tempfolder
  mv yourbook.epub tempfolder
  cd tempfolder
  unzip yourbook.epub
  mv yourbook.epub ../youroldbook.epub
  
  ```
  
  Find and edit the metadata in `opf` file
  
  ```
  find . -iname '*.opf'
  
  ```
  
  Metadata would most probably be in the `<dc:title>` tag,
  
  ```
  <dc:title id="pub-title">TITLE OF YOUR BOOK</dc:title>
  
  ```
  
  `zip` it after editing
  
  ```
  zip -rX ../YOUR_BOOK.epub mimetype META-INF/ .
  
  ```
  
  
  ---
  
  ### Answer by username_4 on 2021-01-11. Score: 4
  
  # with Calibre's [ebook-meta](https://manual.calibre-ebook.com/generated/en/ebook-meta.html)
  
  Example output of `ebook-meta unixpowertools.epub`:
  
  ```
  Title               : UNIX Power Tools, 3rd Edition
  Author(s)           : Jerry Peek, Shelley Powers, Tim O’Reilly & username_8 Loukides [Jerry Peek, Shelley Powers, Tim O’Reilly, and username_8 Loukides]
  Publisher           : O’Reilly Media
  Tags                : COMPUTERS / Operating Systems / UNIX
  Languages           : eng
  Published           : 2009-02-08T23:00:00+00:00
  Rights              : Copyright © 2009 O’Reilly Media, Inc.
  Identifiers         : isbn:9780596103699
  Comments            : <p>The latest edition of this best-selling favorite is loaded with vital information on Linux, Darwin, and BSD. <i>Unix Power Tools</i> 3rd Edition now offers more coverage of bash, zsh, and other new shells, along with discussions about modern utilities and applications. Several sections focus on security and Internet access. There is a new chapter on access to Unix from Windows, and expanded coverage of software installation and packaging, as well as basic information on Perl and Python.</p>
  
  ```
  
  We can use [`awk`](https://www.man7.org/linux/man-pages/man1/awk.1p.html) to get the title only:
  
  ```
  ebook-meta unixpowertools.epub | awk -F "^Title +: " 'NF > 1 {print $2}'
  
  ```
  
  For the example file above, this produces:
  
  > UNIX Power Tools, 3rd Edition
  
  Some ebooks contain the "Title sort" field, which this command doesn't extract but might be relevant to you.
  
  ## Explanation of the command
  
  * `awk -F "^Title +:`  sets `awk`'s separator to "Title" (which has to be at the start of a line due to the `^` anchor), followed by at least one whitespace followed by a colon and space.
  * `NF > 1` will skip empty lines, where no separator was found
  * `{print $2}` prints the second colon which is the text after the string matched by `^Title +:`
  
  [Here](https://stackoverflow.com/questions/11673287/how-to-remove-a-word-prefix-using-grep/56236273#56236273) are more ways to get the string after a prefix, using regular expressions.
  
  ## Supported ebook formats
  
  Regarding the supported file formats, I quote from the [manual](https://manual.calibre-ebook.com/generated/en/ebook-meta.html):
  
  > Supported formats for reading metadata: azw, azw1, azw3, azw4, cbr, cbz, chm, docx, epub, fb2, fbz, html, htmlz, imp, lit, lrf, lrx, mobi, odt, oebzip, opf, pdb, pdf, pml, pmlz, pobi, prc, rar, rb, rtf, snb, tpz, txt, txtz, updb, zip
  >
  > Supported formats for writing metadata: azw, azw1, azw3, azw4, docx, epub, fb2, fbz, htmlz, lrf, mobi, odt, pdb, pdf, prc, rtf, tpz, txtz
  
  
  ---
  
  ### Answer by username_5 on 2020-09-12. Score: 2
  
  Ok, so since nobody has ANY info on this online and this is the top search results. Here is what you are looking for. `exiftool -a -u -g1 nameofthe.epub`. This line gives you a giant output of all the metadata tags you can extract using exiftool. `exiftool -t -Title -Creator -PublicationDate -CreatorFile-as nameofthe.epub` this is how you use it. If you push `-t` lowercase it shows you the description of the tags you pulled. If you run `-T` uppercase, it just shows the tags. Your welcome. Enjoy.
  
  Edit: Also, since exiftool is a GIANT PITA and their help is semi useless. Here is a few scripts I wrote for it that might help someone out. This took me forever... These are formatted for batch files with `%%` and `"`. You may need to edit
  
  This moves any epubs in folder DIR into folders sorted by their Creator (Author).
  
  ```
  for %%f in (DIR\*.epubs) do (exiftool "%%f" "-Directory<Creator")
  
  ```
  
  This renames any epubs in a folder, to the Title and Author
  
  ```
  for %%f in (01-input\*.epub) do (exiftool "-filename<$title - $creator.%%e" "%%f")
  
  ```
  
  To make them recursive into subdirectories you need to change the `for` formatting. Example
  
  ```
  for /R "01-input" %%f in (*.epub) do (exiftool "-filename<$title - $creator.%%e" "%%f")
  
  ```
  
  Edit2: On the off chance your tags contain "illegal" characters, outlined here (<https://exiftool.org/filename.html>), place the tag inside `{}` and put a `;` at the end of the tag. This strips those out so it works. Example script.
  
  ```
  for /R "01-input" %%f in (*.epub) do (exiftool "-filename<${title;} - ${creator;}.%%e" "%%f")
  
  ```
  
  
  ---
  
  ### Answer by username_6 on 2017-09-24. Score: 0
  
  Expounding on @username_1's answer, I created this shell script
  
  ```
  #!/bin/bash
  
  exiftool="/usr/local/bin/exiftool"
  
  filename=$(basename "$1")
  extension="${filename##*.}"
  filename="${filename%.*}"
  directory=$(dirname "$1")
  newfilename=`${exiftool} -T -Title $1`
  
  echo mv "$1" "${directory}/${newfilename}.${extension}"
  mv "$1" "${directory}/${newfilename}.${extension}"
  
  ```
  
  Just run the script, passing the pub filename and it will rename it in-place to be the title of the eBook. Note that it is likely there will be spaces in the filename.
  
  
  ---
  
  