I have a list of lists, a list of file paths for some number of directories.
I want to import that files as lists of lists, where instead of getting one massive 1D list, the distinct directories are preserved from which the imported data goes into.
filePaths={{"/dir1/a.txt", "/dir1/b.txt", "/dir1/c.txt"}, {"/dir2/d.txt",
"/dir2/e.txt", "/dir2/f.txt"}}
Import[#,"Table"]& @/filePaths[[a]]&/@Range[Length[filePaths]]
I tried using a double mapping method, but mathematica gets upset when I try to do it, even though trying Print[] as follows gives me the expected file paths
Print[#] & /@ filePaths[[a]] & /@ Range[Length[filePaths]]
a
if is not defined? To clarify your question, you basically wantn
lists withm
files within, wheren
is your number of directories? (what do you mean by 'directories are preserved'? $\endgroup$Print[#] & /@ filePaths[[a]] & /@ Table[a, {a, 1, Length[filePaths]}]
$\endgroup$