Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'IImporting then exporting multiple files' topicStudent Support Forum > General > Archives > "IImporting then exporting multiple files"

< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic
Author Comment/Response
Xavier
09/29/08 07:00am

Hey,

Yes there is. Let's say you want to work on some files and all these names are stored in a list named myFiles. You have many possibilities to make the imports automatic:

1) Map[ Import[#]&, myFiles ]
=> it will import them the one after the other and the result of this command is the list of the contents of your files. If the names are not strings, replace # with ToString[#], but be careful there is no space within the names of the files!!!

2) If your files are numbered, like A1, A2, ..., it may be simpler to directly work with the head A:
Map[ Import["A"<>ToString[#]]&, Range[Length[myFiles]] ]

3) If you have really weird file names or if I missed the point of your question, this kinda method may work if myFiles contains strings:
Map[ ToExpression["Import[\""<>#<>"\"]"]&, myFiles]

I hope it helps. If it does not answer your question (I have some problems in English), please let me know.
Cheers,

Xavier

URL: http://zavou.zxr.fr,

Subject (listing for 'IImporting then exporting multiple files')
Author Date Posted
IImporting then exporting multiple files Roel Stijl 09/24/08 03:50am
Re: IImporting then exporting multiple files Xavier 09/29/08 07:00am
Re: Re: IImporting then exporting multiple files David M 07/03/10 8:57pm
Re: Re: Re: IImporting then exporting multiple ... Zavou 07/18/10 05:33am
< Previous Comment | Next Comment >Help | Reply To Comment | Reply To Topic