I am using below script to compare two files UEDP35.txt and BB_UEDP35.txt. This script work well if i give inputs manually. Now i need something more. anyone please help.

Inside one folder i have n numbers of files same like UEDP35.txt. for eg: UEDP1.txt,UEDP2.txt,UEDP3.txt... Same like another file BB_UEDP35.txt for eg: BB_UEDP1.txt,BB_UEDP2.txt,BB_UEDP3.txt... here UEDP is common is both files name. If this UEDP are same, then i want to give those two files as inputs. If any different occur while comparing then that has to export into another new file. This has to be done as loop.

One thing how big are the files? if they are small enough you can load them in to memory and check one against the other at the same time. This is a shot in the dark as I dont know what kinda data are in the files...