Re: Finding Filenames that contain a certain string
Re: Finding Filenames that contain a certain string
- Subject: Re: Finding Filenames that contain a certain string
- From: David Bradley <email@hidden>
- Date: Thu, 12 Jul 2007 10:37:15 +0100
Hi,
Please ignore the last message I sent as I've just got it working, I
forgot to include a '*' on the end
so it now looks like this:
set fileList to paragraphs of (do shell script "cd " &
theImagesFolder & " && ls -1 " & strImageRef & "[a-z]*")
Cheers, once again, for all your help, I'm just off to dance around
the room with joy!!!
David Bradley
Senior Web Programmer
Globe Media
Brookfields Way
Manvers
Wath-upon-Dearne
Rotherham
S63 5DL
Tel: 01709 768231
Fax: 01709 768011
email@hidden
www.globe-media.com
On 12 Jul 2007, at 10:25, David Bradley wrote:
Hi
I've got 'set fileNameList to paragraphs of (do shell script "cd
" & (quoted form of POSIX path of startFolder) & " && ls -1
l325010[a-z]")' working without the [a-z] and find files.
When I put '[a-z]' it doesn't not find any.
Just to clarify I want to search through a directory and find files
that start with l325010a, l325010b, l325010c, l325010d, l325010e,
etc all the way to z. Is there a bit more synatx I need. I've
searched on the web, but got no clues.
Cheers for all your help so far, much appreciated.
David Bradley
Senior Web Programmer
Globe Media
Brookfields Way
Manvers
Wath-upon-Dearne
Rotherham
S63 5DL
Tel: 01709 768231
Fax: 01709 768011
email@hidden
www.globe-media.com
On 9 Jul 2007, at 15:18, Mark J. Reed wrote:
On 7/9/07, David Bradley <email@hidden> wrote:
I've just realised that I meant to ask for help on search on
filenames that contain a particular string.
Oh. Well that's a much simpler problem.
set startFolder to (choose folder with prompt "Select folder to
search in")
set fileNameList to paragraphs of (do shell script "cd " &
(quoted form of POSIX path of startFolder) & " && ls -1 l325010[a-
z]")
(The ls call isn't really necessary; the shell does all the work
of finding the filenames and just tells ls to list their names,
but that gets the newline after each one so that "paragraphs of"
will work.)
Now, in this case you have a simpler AppleScript-only option,
assuming you don't have filenames that start with l325010 but have
something other than a-z after them. I'm not at a Mac where I can
test this, so the syntax might be off, but something like this
should work:
set fileNameList to every file of startFolder whose
name starts with "l325010"
Might have to do it in a Finder tell block.
--
Mark J. Reed < email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
40globe-media.com
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden