Yes, this process can be done with the help of a script. However, in order to do that, you will need a development utility which you can use to create and run your script. You can use Google in order to find more information about this matter.
If you are not familiarized with scripting and programing languages, I suggest you use the Merge software. It's very intuitive and easy to use.