a function get_fn() to find the ID of a file when the filename is given. I
> assume this function finds the first file with the given filename.
Why should you have to resort to assuming, here? Read the documentation --- that's what you have it for!
From what little you mentioned, it doesn't seem like this function you found is really a substitute for FindFirst/FindNext, which searches for a file by a name pattern with optional wildcards. Yours feels more like a first step towards stat(), i.e. a way to find information about a file you know the exact name of.