It would also help if you provided actual examples
of the directories and file names, rather than this vague "file1" type stuff.
In addition, please explain exactly how the files should be ordered when the commands run. Do they have to be matched up by file name, or by directory position, or what?
Finally, please post any actual code you've already tried, to help us better understand your goal and your exact level of ability.
And please use [code][/code]
tags around your code and data, to preserve formatting and to improve readability.
The best solution is probably simply to load the files from the directories into arrays, with matched index numbers, and run a simple loop over the values of the indexes. But again, we need more details first.