The way how I do it is to firstly generate the name of the input files into a table of strings, here's an example
nameInput = Table[StringTemplate["/Users/Projekt/output/input/b5_t`t`_a`a`.dat", InsertionFunction -> (ToString@NumberForm[#, {2, 2}] &)]@<|
"t" -> 0.01 k, "a" -> 0.01 l|>, {k, 1, 3}, {l, 0, 4}];
which produces the following
{{"/Users/Projekt/output/input/b5_t0.01_a0.00.dat",
"/Users/Projekt/output/input/b5_t0.01_a0.01.dat",
"/Users/Projekt/output/input/b5_t0.01_a0.02.dat",
"/Users/Projekt/output/input/b5_t0.01_a0.03.dat",
"/Users/Projekt/output/input/b5_t0.01_a0.04.dat"},
{"/Users/Projekt/output/input/b5_t0.02_a0.00.dat",
"/Users/Projekt/output/input/b5_t0.02_a0.01.dat",
"/Users/Projekt/output/input/b5_t0.02_a0.02.dat",
"/Users/Projekt/output/input/b5_t0.02_a0.03.dat",
"/Users/Projekt/output/input/b5_t0.02_a0.04.dat"},
{"/Users/Projekt/output/input/b5_t0.03_a0.00.dat",
"/Users/Projekt/output/input/b5_t0.03_a0.01.dat",
"/Users/Projekt/output/input/b5_t0.03_a0.02.dat",
"/Users/Projekt/output/input/b5_t0.03_a0.03.dat",
"/Users/Projekt/output/input/b5_t0.03_a0.04.dat"}}
This works well especially when your input files follows a pattern.
Then you can simply import your data by importing the table
data = Table[Import[nameInput[[i, j]]], {i, 1, 3}, {j, 1, 4}];
hope this helps!
Select, as you can weed out directories viaSelect[ FileNames[...], !DirectoryQ[#]&], or if they wish to exclude hidden files (i.e. starting with a "." on a unix/linux based system - mac included), the predicate can be expanded to!(DirectoryQ[#] || StringMatchQ[#, "." ~~ ___])&. – rcollyer May 06 '12 at 15:41%(akaOut) can result in confusion if you don´t take care of the evaluation order (e.g. if you do not put all depending code into one cell). – Yves Klett May 06 '12 at 15:44Import[#]&/@filesinstead of the simplerImport/@files? – Albert Retey May 07 '12 at 19:59Importwith additional arguments or options. – Yves Klett May 07 '12 at 20:03