Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #15104

Re: files

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: files
Date 2013-07-03 08:46 +0000
Message-ID <kr0odg$3db$1@smc.vnet.net> (permalink)
References <20130702044702.A750C6A51@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


Export[#, "Contents of file " <> #] & /@
  {"a.txt", "b.txt",
   "5673ANTIOQUIA.txt", "nuevoANTIOQUIA.txt", "ANTIOQUIAcomplejo.txt"};


files = Select[FileNames[], ! StringFreeQ[#, "ANTIOQUIA"] &];


fileContents = Import /@ files;


Thread[{files, fileContents}]


{{"5673ANTIOQUIA.txt",
  "Contents of file 5673ANTIOQUIA.txt"}, {"ANTIOQUIAcomplejo.txt",
  "Contents of file ANTIOQUIAcomplejo.txt"}, {"nuevoANTIOQUIA.txt",
  "Contents of file nuevoANTIOQUIA.txt"}}



Bob Hanlon




On Tue, Jul 2, 2013 at 12:47 AM, Francisco Gutierrez <fgutiers2002@yahoo.com
> wrote:

>
> Dear Group:
> Suppose that I choose a directory:
>
> SetDirectory["S:\\mydirectory"]
>
> And in that directory I have a set of files, each of which contains the
> string "ANTIOQUIA". For example "5673ANTIOQUIA.txt", "nuevoANTIOQUIA.txt",
> "ANTIOQUIAcomplejo.txt"
>
> I already have managed to find the files automatically.
> Now, my two questions:
>
> a. Is there a way to open them authomatically from Mathematica?
> b. Even better, to find them and import them into Mathematica?
>
> Thanks and best regards
>
> Francisco
>
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: files Bob Hanlon <hanlonr357@gmail.com> - 2013-07-03 08:46 +0000

csiph-web