MathGroup Archive 2013

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

Search the Archive

Re: files


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 at 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
>
>




  • Prev by Date: Problem with Simplify with Assumptions
  • Next by Date: Re: Russian Peasant Multiplication / was question on
  • Previous by thread: files
  • Next by thread: Re: files