Skip to main content

Output Export in Mathematica

I have a command line that generates lists as output and is running in a loop, so generates, multiple long lists. Each list is to be exported as a .txt file. How can I automate the name generation of the output files. I intend to use the same name as the input file but with the .txt extension in output of course.

For[
  i = 1,i < 3,i++,
  outdata = ReadList[ test[[i]], Record, RecordSeparators -> {{">"},{" "}} ];
  Print[outdata]
  ]

How can I automate the export?