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: "Mark J. Reed" <email@hidden>
- Date: Mon, 9 Jul 2007 10:18:49 -0400
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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden