Re: Parsing filenames
Re: Parsing filenames
- Subject: Re: Parsing filenames
- From: Emmanuel <email@hidden>
- Date: Fri, 13 Jun 2003 08:40:59 +0200
At 10:38 PM -0400 11/06/03, brian mather wrote:
>
I have a folder full of files that follow a standard naming convention:
>
[prefix][digits]_[string].extension
>
The [prefix] part of the name is either "p" or "pANYTEXT-".
>
The digits is a string of 6 or 7 numbers.
>
the _[string] is sometimes present and sometimes absent.
>
And finally the extension while typically present does not necessarily have
>
to exist and I'd like the script to be able to gracefully handle either
>
instance.
>
>
(e.g.: p123.tif; pFOO-456; pBAR-789_yippee.jpg; ...)
>
>
I'm interested to parse the filename extracting and writing to a file the
>
digits and the string following the underbar where applicable.
My suggestion would be:
1. use "list folder" to get the list of the file names ("without invisibles" is a good tip)
2. use tid's ("return") to make the list a return-delimited string (assuming the files don't have a "return" in their names)
3. use the regular expressions to extract the characters you want.
Regular expressions are implemented in the (free) Satimage osax
<
http://www.satimage-software.com/en/softx.html#osax>
Emmanuel
Satimage-software
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.