Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: Import multiple files with same extension from a folder

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128235] Re: Import multiple files with same extension from a folder
  • From: Yves Klett <yves.klett at googlemail.com>
  • Date: Thu, 27 Sep 2012 22:48:48 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <k40vu9$ja9$1@smc.vnet.net>

The following suggestion is from:
http://mathematica.stackexchange.com/q/5242/131

*snip*
Have a look at FileNames:

files=FileNames["*.pdf", NotebookDirectory[]]

    {"a.pdf","b.pdf","c.pdf"}

will get you a list of all files in the directory where your notebook
resides (of course you can choose any path) that match "*.pdf". You can
then import the files like this:

Import[#]&/@files

or if you want certain files (look at the help for Part and Span):

Import[#]&/@files[[-3;;-1]] (*last three files*)
Import[#]&/@files[[1;;10]]  (*first ten files*)

*snip*

Regards,
Yves


Am 27.09.2012 09:40, schrieb Dominik Hezel:
> Hello,
> 
> I have a folder with different files, e.g.
> 
> test1.exp
> test2.exp
> test1.log
> test2.log
> ...
> 
> The number of files and actual file names is unknown. I would like to import all files ending with .exp. How do I do this rather simple task?
> 
> Thanks for any help.
> 



  • Prev by Date: Fast selection of lots of elements from a large list
  • Next by Date: Re: Import multiple files with same extension from a folder
  • Previous by thread: Re: Import multiple files with same extension from a folder
  • Next by thread: Re: Import multiple files with same extension from a folder