Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: files
Replies: 1   Last Post: Jul 3, 2013 4:46 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Bob Hanlon

Posts: 906
Registered: 10/29/11
Re: files
Posted: Jul 3, 2013 4:46 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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}]

"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

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum 1994-2015. All Rights Reserved.