C
CBFalconer
Hans said:Yes, I know that.
The scenario is this. I download a lot of ebooks--PDF's, CHM's,
DJVU's, etc. I want to create a separate index using the operating
system's folders as a kind of catalog and store the ebooks
elsewhere. My solution is to create proxy files for the ebooks
(i.e., empty text files with the same names as the original). The
text files now become like catalog cards in the library. One
"catalog card" (text file) will have the ISBN in front and another
has the book name in front.
I need to do the creation of the files in bulk because I download
like hundreds of ebooks per day. So, the cataloging part is really
slowing me down.
I think you are over complicating the project. You have a herd of
filenames, which names are not complete without the path to their
directories. Yet you want to be able to easily update that path.
Also some other information is probably required.
I would design a structure that holds the information. Path and
filename are obviously strings. Searching has to be on the basis
of both. Other information is just carried along.
With that structure you can simply use a hashtable. You will need
to design a way to dump the table to a file, so you can recreate it
as needed. But the table will provide rapid searching and access.
I would suggest you look at hashlib.zip, to be found at:
<http://cbfalconer.home.att.net/download/hashlib.zip>
which is purely standard C and licenced under the GPL. I.e. free.
The file include application examples.