MathGroup Archive 2009

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

Search the Archive

Re: Filenames with ToString

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99955] Re: Filenames with ToString
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Wed, 20 May 2009 04:58:31 -0400 (EDT)
  • References: <guu2ef$67d$1@smc.vnet.net>

Alain,

What's in NAME2? If it's a string there's no need for a ToString.

Given that it's a symbol, which you seem to imply, the syntax should
be

FileNames[ToString[NAME2]~~"*.jpg"]

or

FileNames[ToString[NAME2]<>"*.jpg"] .

In your code, FileNames["" ~~ ToString[NAME2]*".jpg"], the "" ~~ seem
superfluous as you say that NAME2 is the first part of the file name.
The * should be between the string quotes and the "*.jpg" string
should be either StringJoined ( <> ) or StringExpression -ed (~~)
together with the stem part.

Cheers -- Sjoerd

On May 19, 12:42 pm, Alain Mazure <alain.maz... at oamp.fr> wrote:
> Hi again
>
>    I have several files with extension .jpg of the type
>
> "C1822_8_025_1.jpg", "C1822_8_025_2.jpg"
> "C1943_11_025_1.jpg", "C1943_11_025_2.jpg" .....
>
> I know the first part of the name  which was given by : "" ~~
> ToString[NAME2]  with NAME2: C1822, C1943 ...
>
> How to use FileNames in order to have, for a given NAME2 all the *.jpg
> files in order to import them ?
>
>    The command: FileNames["" ~~ ToString[NAME2]*".jpg"]  does not w=
ork
>
>   Thanks !!!
>
> Alain Mazure
>
> Laboratoire d'Astrophysique de Marseille
> P=F4le de l'=C9toile Site de Ch=E2teau-Gombert
> 38, rue Fr=E9d=E9ric Joliot-Curie
> 13388 Marseille cedex 13, France
>
> http://alain.mazure.free.fr/
>
> Mails:
> alain.maz... at oamp.fr
> alain.maz... at free.fr
>
> Phones:
> Lab: 33(0)491055902
> Mobile: 33(0)603556287
> Fax: 33(0)491661855
> SKYPE: MAZURE-ALAIN



  • Prev by Date: Re: Filenames with ToString
  • Next by Date: Re: Filenames with ToString
  • Previous by thread: Re: Filenames with ToString
  • Next by thread: Re: Filenames with ToString