This question already has an answer here:

I am calculating with the depth data recorded in a number of files with extension .log.

The depth data is like this and I loaded it by means of Mathematica:

{"2016/01/13 00:00:30", 42, 754}, {"2016/01/13 00:01:00", 42, 754}, 
{"2016/01/13 00:01:30", 42, 753}, {"2016/01/13 00:02:00", 42, 752}, 
{"2016/01/13 00:02:30", 42, 753}, {"2016/01/13 00:03:00", 42, 754}

I succeed in obtaining the depth data and transforming it into 42.754, 42.754, 42.753, 42.752, 42.753, 42.754, etc.

However, this only processes the data in one file. However, I have in my folder a group of about 10 files. How can I read in all the data in a folder in an easier way than to do it individually?


marked as duplicate by Dr. belisarius, MarcoB, m_goldberg, user9660, Yves Klett Feb 11 '16 at 6:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Look at the docs for FileNames[ ] , Map[ ] and perhaps Flatten[ ___,1]. Voting to close. $\endgroup$ – Dr. belisarius Feb 11 '16 at 1:51

In case that your file names are file1.log, file2.log,...,file10.log try the following

Table[Import[i], {i, FileNames["C:\\Homeworks\\depth\\file*.log"]}]

The context of FileName command should be the directory containing your files.

  • $\begingroup$ Absolutely, Mr. demm your answer captured the main problem. Dr. Belisaruis Flatten[ __,1] was also nice trick. $\endgroup$ – Mehmet Feb 11 '16 at 3:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.