View Single Post
Old 03-21-2011, 06:25 PM   #11
reading
Junior Member
reading began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Mar 2011
Device: Kindle
If doing this in windows ...

calibredb.exe list --separator , -w 255 -f title,series >tmp.txt
FOR /F "usebackq tokens=1-3 delims=," %a in ("tmp.txt") do if "%b"=="%c" echo %a

The first command should create a comma seperated file with all of your books in it, the format will be "ID,title,series", if you want different fields add them to the -f switch

the second commands reads each line from the text file, seperates each of the comma seperated values into variable %a through %c, in this example we check to see if title (%b) and series (%c) are the same and if so echo the calibre ID which can be used in other calibredb commands.

Note if you add more fields, you need to increase the number of tokens in the second command

like so ..

calibredb.exe list --separator , -w 255 -f authors,title,series >tmp.txt
FOR /F "usebackq tokens=1-4 delims=," %a in ("tmp.txt") do if "%c"=="%d" echo %a,%b,%c

In this case we add authors, and display the ID, title and author on the books that have the problem.

in theory, you can figure out the calibre directory for each file from this

say your calibre database is in C:\Calibre then

calibredb.exe list --separator , -w 255 -f authors,title,series >tmp.txt
FOR /F "usebackq tokens=1-4 delims=," %a in ("tmp.txt") do if "%c"=="%d" echo "C:\Calibre\%b\%c (%a)\metadata.opf"

Should give you a list of all the metadata files you need to go edit ....
reading is offline   Reply With Quote