Using Find with Shell on Mac

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Using Find with Shell on Mac

** Clarence P Martin ** via use-livecode
I'm pretty much fed up with Spotlight.

On Linux apps I use Locate, which is really efficient.

but setting up and keep the locate dbase on mac is also frought with issues.  it will not index $Home

which is weird.

FIND is slower of course, but perfectly effective.

this:

find ~/ -iname *.livecode

from terminal get me *every* with .livecode in my user folder. in my UI's for locate I just get all the results into a var, then filter that var with strings and update the results field… works great, very fast.

But this, inside the msg box:

put "find ~/ -iname *.livecode" into tShell
put shell(tShell)


is only returning a single line:

/Users/Brahmanathaswami//OneDrive/_RevData/Books in Rev/HAP_Trilogy Reader Source/source/HAP_Trilogy-Reader1-1.livecode


Why don't we get all the results we do in terminal?


BR

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using Find with Shell on Mac

** Clarence P Martin ** via use-livecode
Not sure what $Home is. I didn't know you could refer to your home folder that way. But keep in mind that you can change what Spotlight does and does not index. you home folder typically is not a place you would create new folders and files for. What would be the point to indexing it?

Bob S


> On Aug 9, 2017, at 15:56 , Sannyasin Brahmanathaswami via use-livecode <[hidden email]> wrote:
>
> but setting up and keep the locate dbase on mac is also frought with issues.  it will not index $Home


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using Find with Shell on Mac

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode
You should put quotes around the "*.livecode", because

find ~/ -iname "*.livecode" -print

will do what I think you want to do.

Whereas if you do,

find ~/ -iname *.livecode -print

the  *.livecode   is seen by, and interpreted by, shell - and so expands
to the livecode files in your home directory. You need to put quotes
around it so that it is passed as a string to the find command, which
can then use it to match names.


(I'm not 100% sure why you didn't have the same problem in terminal as
well as in msg box - but I'd change this and expect it will help).

-- Alex.


On 09/08/2017 23:56, Sannyasin Brahmanathaswami via use-livecode wrote:

> I'm pretty much fed up with Spotlight.
>
> On Linux apps I use Locate, which is really efficient.
>
> but setting up and keep the locate dbase on mac is also frought with issues.  it will not index $Home
>
> which is weird.
>
> FIND is slower of course, but perfectly effective.
>
> this:
>
> find ~/ -iname *.livecode
>
> from terminal get me *every* with .livecode in my user folder. in my UI's for locate I just get all the results into a var, then filter that var with strings and update the results field… works great, very fast.
>
> But this, inside the msg box:
>
> put "find ~/ -iname *.livecode" into tShell
> put shell(tShell)
>
>
> is only returning a single line:
>
> /Users/Brahmanathaswami//OneDrive/_RevData/Books in Rev/HAP_Trilogy Reader Source/source/HAP_Trilogy-Reader1-1.livecode
>
>
> Why don't we get all the results we do in terminal?
>
>
> BR
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using Find with Shell on Mac

** Clarence P Martin ** via use-livecode


On 10/08/2017 01:10, Alex Tweedly via use-livecode wrote:

> You should put quotes around the "*.livecode", because
>
> find ~/ -iname "*.livecode" -print
>
> will do what I think you want to do.
>
> Whereas if you do,
>
> find ~/ -iname *.livecode -print
>
> the  *.livecode   is seen by, and interpreted by, shell - and so
> expands to the livecode files in your home directory. You need to put
> quotes around it so that it is passed as a string to the find command,
> which can then use it to match names.
>
That's not quite right - it will be the files in your *current*
directory, not your home directory. In the case of the msg box, that
will be your home directory - but doing it from terminal, it will be
whatever directory you happen to be in at the time - so that's why it
would give different results.
Alex.

>
> (I'm not 100% sure why you didn't have the same problem in terminal as
> well as in msg box - but I'd change this and expect it will help).
>
> -- Alex.
>
>
> On 09/08/2017 23:56, Sannyasin Brahmanathaswami via use-livecode wrote:
>> I'm pretty much fed up with Spotlight.
>>
>> On Linux apps I use Locate, which is really efficient.
>>
>> but setting up and keep the locate dbase on mac is also frought with
>> issues.  it will not index $Home
>>
>> which is weird.
>>
>> FIND is slower of course, but perfectly effective.
>>
>> this:
>>
>> find ~/ -iname *.livecode
>>
>> from terminal get me *every* with .livecode in my user folder. in my
>> UI's for locate I just get all the results into a var, then filter
>> that var with strings and update the results field… works great, very
>> fast.
>>
>> But this, inside the msg box:
>>
>> put "find ~/ -iname *.livecode" into tShell
>> put shell(tShell)
>>
>>
>> is only returning a single line:
>>
>> /Users/Brahmanathaswami//OneDrive/_RevData/Books in Rev/HAP_Trilogy
>> Reader Source/source/HAP_Trilogy-Reader1-1.livecode
>>
>>
>> Why don't we get all the results we do in terminal?
>>
>>
>> BR
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using Find with Shell on Mac

** Clarence P Martin ** via use-livecode
In reply to this post by ** Clarence P Martin ** via use-livecode
@ bob

try it in msg

put $HOME

see the dictionary for $  

but this is one more of those "Alice in wonderland features" of LC that you will only discover after you fall into the hole (hehe)  like the long owner of the target



"why index"

to locate and find return the long paths to the files discovered.

this has very high utility for "fuzzy" logic filtering based on simple LC string line filtering.  I once had a CGI on our XServer that could read the entire box in milliseconds and a search engine interface that could return details lists for a over a million files on that box in milliseconds and the filters were awesome… by volume + extension or path string etc… then Apple killed off xServe we switch to Synology storage and lost a lot of services (and also a lot of admin pain too)

So I want to adapt this to run on any local machine. We have FoxTrot Pro… which will actually index the contents, but again, some app designers don't know when to stop… but typically 98% of the search if a path/filename query if you have 300,000 image on your hard drive locally and you are building (app|keynote| movie |newsletter) then spotlight doesn't cut it… I also have an javasript that will drive collections of found files to Adobe's Bridge which then serves as a kind of slave for a visible catalogs of search results.

@ Alex: Yes! thanks

 this works adding quotes plus -print

put format ("find ~/ -iname \"*.livecode\" -print") into tShell
put shell(tShell)

A tad slow.. but good enough. Why Apple will not allow locate to index the user's home directory is mysterious… probalby is a way.. because the located dbase is so much faster and changes are rare enough that running updates on a bi-weekly cron would be good enough.

And this in fact goes to documentation for LC… e.g. if we had an LC concordance then if you a search for "target" would turn up    

the long owner of the target.. Hmm interesting I search in spotlight for dictionary and the typed Concordance (wasn't yet in dictionaryh and hit on SSBookConcordance.rev  something that Hugh created.


On 8/9/17, 1:15 PM, "use-livecode on behalf of Bob Sneidar via use-livecode" <[hidden email] on behalf of [hidden email]> wrote:

    Not sure what $Home is. I didn't know you could refer to your home folder that way. But keep in mind that you can change what Spotlight does and does not index. you home folder typically is not a place you would create new folders and files for. What would be the point to indexing it?
   
    Bob S
   
   

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using Find with Shell on Mac

** Clarence P Martin ** via use-livecode
OH RIGHT. I thought you were talking about using this in the terminal. I know about the LC environment variables.

Bob S


> On Aug 9, 2017, at 18:51 , Sannyasin Brahmanathaswami via use-livecode <[hidden email]> wrote:
>
> @ bob
>
> try it in msg
>
> put $HOME
>
> see the dictionary for $  


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using Find with Shell on Mac

** Clarence P Martin ** via use-livecode
On 08/10/2017 09:36 AM, Bob Sneidar via use-livecode wrote:
> OH RIGHT. I thought you were talking about using this in the terminal. I know about the LC environment variables.
>
> Bob S


What does this do in Terminal?

'echo $HOME'

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using Find with Shell on Mac

** Clarence P Martin ** via use-livecode
Well it's case sensitive for one. echo $home produces a blank line. $HOME produces my home folder. But I beg to be excused. I got into computers at first because of the Macintosh. I cannot remember hundreds of commands along with their varied arguments and flags and nuances. I will probably forget the $ in the terminal in about 2 weeks.

I avoided PC's for years because all they ran was DOS and I would flip burgers before I learned DOS. I still have to continually refer to the dictionary and online API's to program. I do not have the mind for memorization of arbitrary information. I've only gotten one trivia question right in all my years. The correct answer is, "Kickapoo Joy Juice".

Bob S


> On Aug 10, 2017, at 08:38 , Warren Samples via use-livecode <[hidden email]> wrote:
>
> On 08/10/2017 09:36 AM, Bob Sneidar via use-livecode wrote:
>> OH RIGHT. I thought you were talking about using this in the terminal. I know about the LC environment variables.
>> Bob S
>
>
> What does this do in Terminal?
>
> 'echo $HOME'
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using Find with Shell on Mac

** Clarence P Martin ** via use-livecode
On 08/10/2017 10:46 AM, Bob Sneidar via use-livecode wrote:
> But I beg to be excused.


:D It's okay, Bob. Stay curious!

Warren

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Loading...