After you fetch the two files, you could route the success relationship twice via two different connections. One of those connection continues those two files down you r existing dataflow path. The secondary path could go to a replaceText processor that replaces the entire content of the FlowFile with the filename which is store in a FlowFile attribute named "filename". Editing the content down this secondary path does not affect the content of the FlowFile in the other dataflow path.
Now that you have the filename in the content you can use other processors to store that content with the filename wherever you want for future retrieval. or you could merge those flowfile in to single FlowFile that would then contain the list of filenames before you store it. This is just a matter of your specific use case for later consumption of this stored data.
Take a look at the putDistributedMapCache processor as an example.
If you found this response addressed your query, please take a moment to login and click on "Accept as Solution" below this post.