• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Shell Script 'find'
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shell Script 'find'


  • Subject: Re: Shell Script 'find'
  • From: Simon Topliss <email@hidden>
  • Date: Sat, 14 Dec 2002 17:19:10 +0000

Thanks, Randal,

That works. Is it possible to turn that into a negative as well?

The '-name' option can be preceded with '!' to find files that don't match
the search string.

Simon

On 14/12/02 4:23 pm, "Randal L. Schwartz" <email@hidden> wrote:

>>>>>> "Simon" == Simon Topliss <email@hidden> writes:
>
> Simon> If I have have the following script:
> Simon> do shell script "find " & searchFolder & " -name " & searchStr
>
> Simon> The variables are Posix path and quoted form.
>
> Simon> How do I tell the 'find' program to ignore case of the variable
> 'searchStr'?
>
> Simon> Is it even possible? I see that regex has 'REG_ICASE', but I
> Simon> can't find any examples as to how to use it and don't know if
> Simon> will help anyway.
>
> Ordinary "find" doesn't have a case-insensitive option, since it grew
> up in the Unix world where case does matter.
>
> Second, the "-name" option doesn't take a regex, but rather a glob
> pattern. Although some of the operators are similar, they are
> distinct beasties, and thinking of one when you mean the other will
> lead to bad broken code.
>
> If you can change "abc" into "'[aA][bB][cC]'" somehow easily with
> AppleScript (I don't know, I'm not an expert, that's why I'm on *this*
> list :), then you could feed that in place of "searchStr".
>
> Otherwise, you can just grep -i for it, at a slight expense of runtime:
>
> find /someplace -print | grep -i '/abc$'
>
> will find abc ABC aBc and so on. It's up to you to figure out how
> to build this with appleScript concatenation safely. :)
_______________________________________________
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.

  • Prev by Date: newbie/ How do i script disconnect from PPOE
  • Next by Date: Replace newer files
  • Previous by thread: Re: newbie/ How do i script disconnect from PPOE
  • Next by thread: Re: Shell Script 'find'
  • Index(es):
    • Date
    • Thread