View Single Post
Old 08-05-2007, 01:30 AM   #1
KaiGoth began at the beginning.
Posts: 48
Karma: 22
Join Date: Aug 2007
Device: Sony PRS500 & PRS700
BASH script for *2lrf utilities (thanks Kovid!)...

Hey all, I notice that the libprs500 utils seem really popular and have a ton of functionality. Like many others, I downloaded all of the BAEN CDs and wanted to do a mass conversion. Put together a real quick script in case anyone else is looking for something similar. (Didn't see anything in a search, but might have missed if someone already did similar)

Basically, just dump all your files of the same type (.lit, .rtf, etc.) into a single directory, and run the below script from that directory. First option is for the type of file converting from, second option is any *2lrf option you want to add (like meta-data changes). An example would be ./ rtf "--publisher=BAEN"

I tend to batch convert files in groups by author/series myself, but I ALWAYS name my source file to the book title. If you don't, remove the "-t $targ" portion from the script. This makes it easy for me since I have a ton of files that don't have any meta-data, and I can at least get the title set without any extra work.

Works pretty simply for me, so I thought I'd share. Finished the first 5 CDs in less than 30 minutes.

Thanks again to Kovid for all his work!!


# $1 = input file type
# $2 = options

ls -1 | grep \.$1$ | sed "s/\.$1//g" > inputfiles

exec 3<inputfiles
while read -u 3 targ
echo "Converting File $targ.$1 to $targ.lrf"
$12lrf "-t $targ" $2 $targ.$1 &> /dev/null
exec 3<&-

rm inputfiles

Last edited by KaiGoth; 08-05-2007 at 02:33 AM. Reason: formatting
KaiGoth is offline   Reply With Quote