Did my code do anything for you? It does what you're thinking. In mine it reads a list of lisp files I have to write. (I know there are ways to read the contents of a folder, but this was written before vl-functions). Anyway, if you look, you'll see it looks for *C:* and finds everything on that line after, then strips off everything after (. Sounds like something similar to what you are looking for.