Re: do shell scripting a "Find"
Re: do shell scripting a "Find"
- Subject: Re: do shell scripting a "Find"
- From: Brian Gist <email@hidden>
- Date: Sat, 26 Feb 2005 11:07:11 -0700
> I am wanting to find files and applications using shell & applescript. Nothing
> is working, is there anyone who can show me a working method, post a snippet
> to start from, or just some tidbit to work with. I am trying to FIND an
> application or file whose name contains "TheName" and return a path,
> completely in the background? Please help.
I haven't seen this suggested yet, but forgive me if someone beat me
to it...my aggregator is acting up.
If you are just looking for the path to a file called "TheName" it
would probably be faster to use the unix command `locate` because that
is a db ... however if you haven't added /usr/libexec/locate.updatedb
to the crontab, that is probably not updated ... email me if you need
help adding that to crontab. Anyhow, try this script ...
set fileNameContains to "Math"
set fileNameAlsoContains to "Fire"
set fileListing to (do shell script "locate " & fileNameContains & "|
grep" & fileNameAlsoContains)
This should return to you a list of all the file names containing
"Math" (case sensitive) and I have piped it to grep (text filter) for
the term "Fire" ... it will give me all the files titled "Math" ...
which also have "Fire" which are, on my system, the mathlibs for
Firefox.
If your computer hasn't updated the updatedb, run this command
sudo /usr/libexec/locate.updatedb
Don't be tempted to put an & after that command ... it will barf. It
will run for about 20 minutes depending on processor and number of
files. But once its done, it's done. Then locates are nearly
instant.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden