Thanks for taking the time to share this with everyone. I did run into a problem though. I would get an error message similar to this:
Msg 567, Level 16, State 5, Line 36
File 'xxxxxx' either does not exist or is not a recognizable trace file. Or there was an error opening the file.
I found that if you change this line of code:
SET @CMD = 'DIR ' + @tracelocation + '*.TRC' + ' /B'
To this (adding double-quotes):
SET @CMD = 'DIR "' + @tracelocation + '*.TRC"' + ' /B'
Then it works fine. Thanks.