finding locations of many files via kpse

Mike Marchywka marchywka at hotmail.com
Tue Jul 2 13:18:34 CEST 2024





________________________________________
From: texhax <texhax-bounces+marchywka=hotmail.com at tug.org> on behalf of Norbert Preining <norbert at preining.info>
Sent: Tuesday, July 2, 2024 5:01 AM
To: texhax at tug.org
Subject: finding locations of many files via kpse

Hi everyone,

For a given set of input file names (arguments to includegraphics or
usepackage or ...), I would like to check the availability/location
quickly.

Of course I could call
        kpsewhich $i
for each and every file, but I think this is not the most effective way.

My ideas are in decreasing preference:
* call kpsewhich with as many arguments as possible, reducing the
  calling overhead
        kpsewhich file1 file2 file3 ...
  (up to maximal possible)
* use a lua script and the built-in kpse module
* write a C program that links to libkpathsea and does that

Any other suggestions?


[ using stupid browser reply in hotmail arrh ]

If the search path is static, you could write a script to 
expand the kpse path to explicit directories 
and then list all the files in each dir in search order into a new file  . Repeated grepping
of this file could be pretty fast as it should stay buffered
in memory. Kind of a kluge but it may be faster than
kpse all the time.



Thanks a lot

Norbert

--
PREINING Norbert                              https://www.preining.info
arXiv / Cornell University   +   IFMGA Guide   +   TU Wien  +  TeX Live
GPG: 0x860CDC13   fp: F7D8 A928 26E3 16A1 9FA0 ACF0 6CAC A448 860C DC13



More information about the texhax mailing list.