[Tip] DOS cmd file tools for Calibre searches
Hi guys. I have a lot of books and add to my libraries constantly. I'm at 52k right now, across 19 libraries and I was losing track of which books I had and where they were. I decided to write a couple of batch files to help me keep track of them and find them and thought other people might want to try them out too. They're tiny, easy to understand, and they work for me, so far.
First, from the root of your library, you run AllCalibreBooks.cmd to dump all the library file names into 1 file called Calibre_Books.txt. It will then sort the file names into alphabetical order and dump the filtered results into a file named CalibreBooksSorted.txt
del Calibre_Books.txt
del CalibreBooksSorted.txt
dir/s | findstr "azw mobi lit epub" > Calibre_Books.txt
echo File Created
echo SORTING
sort Calibre_Books.txt /O CalibreBooksSorted.txt
To search the new "database" you run BookSearch.cmd. You'll see a DOS box with the top line asking "Search for?" You can search for basically anything. An author name, a book name, the actual file name, a piece of a word...whatever.
You DO have to remember though that the only information it has collected is the standard file data, not the book metadata. Thankfully you'll get the first 70 letters in the book name, you'll get the author name, and the file location. Even with my library, the search is instant. For me so far, it's been quite valuable.
Here is the book search code:
@echo off
REM Book Search 0.6 3/28/2021
REM /I for case insensitive /C for looking for the whole string not just pieces
:START_HERE
set /P SearchFor="Search For?"
Findstr /I /C:"%SearchFor%" CalibreBooksSorted.txt
REM the &cls is supposed to clear the screen
pause&cls
GOTO :START_HERE
For me, this means I find the "lost" book from the Fantasy library in the Sci-Fi library, I DON'T download free Amazon books that I already have, and I can see at a glance EVERY book I have from an author at once instead of searching each library separately.
This forum has been very helpful to me so I hope someone will find this useful. It's nice to be a contributor for once instead of the guy crying for help. :-)
And remember, both files go in the root of your calibre library (although I use shortcuts for them, of course).
Last edited by Dan Goodale; 03-28-2021 at 05:07 AM.
|