I am trying to import several data files all at once into my Mathematica notebook. I want get all of them together by evaluating one expression (perhaps a Do-Loop).

testAand1 = Import["/Users/..../momentum_A_1.dat"];
testBand1 = Import["/Users/..../momentum_B_1.dat"];
testZand10 = Import["/Users/..../momentum_Z_10.dat"];

Kindly suggest how I can do it.

  • $\begingroup$ Look up ‘Map’ in the documentation. $\endgroup$ Sep 3, 2020 at 16:31
  • 1
    $\begingroup$ And FileNames $\endgroup$ Sep 3, 2020 at 16:40
  • $\begingroup$ Your example indicates that there are two files with the same name in in one directory. I don't know any OS that permits that, so I think its a typo that you should correct. $\endgroup$
    – m_goldberg
    Sep 3, 2020 at 17:29
  • 1
    $\begingroup$ This question is closely related and may help you. $\endgroup$
    – m_goldberg
    Sep 3, 2020 at 17:45


Browse other questions tagged or ask your own question.