MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: reading all the files in one directory

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68912] RE: [mg68884] reading all the files in one directory
  • From: "David Annetts" <davidannetts at aapt.net.au>
  • Date: Wed, 23 Aug 2006 07:15:26 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Sofia, 

> Could anyone please tell me how can a read all the files in 
> one directory?
> I have to read around 60 files with odd names.

It's straightforward ....  

Change to the directory; get a list of the file names; read them,
prefereably using Import[]; continue.

For example, below I read all the txt files into a list.  The i'th element
of the list contains data from the i'th file. 

	SetDirectory["c:/Tmpfiles"];
	ifile = FileNames["*.txt"]
	idata = Import[#, "LIST"] & /@ ifile;

If it is sensible to do so (it depends on the structure of the individual
lists), you can plot the data individually using
	
	ListPlot[#]& /@ idata;

Or all together using

	MultipleListPlot[idata];

Regards,

Dave.


  • Prev by Date: Re: reading all the files in one directory
  • Next by Date: Re: reading all the files in one directory
  • Previous by thread: Re: reading all the files in one directory
  • Next by thread: Re: reading all the files in one directory