Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

applying find where Mac aliases exist

1 view
Skip to first unread message

Robert Peirce

unread,
Dec 20, 2009, 11:28:30 AM12/20/09
to
I use aliases to link files to higher level directories for easy
processing. I now want to find the root files and operate on them with
a shell script. However, find also finds all the Mac aliases! I tried
using -type f, for regular files, but the aliases show up as regular
files.

Is there an argument to find that will by-pass the aliases.
Alternately, is there another way to find the root files and to apply a
shell script to them?

Robert Peirce

unread,
Dec 20, 2009, 11:33:39 AM12/20/09
to
In article <bob-B811D1.1...@nntp.aioe.org>,
Robert Peirce <b...@peirce-family.com> wrote:

I forgot. The typical way this is used is as follows:

Category/alias to file
Category/YYYY/alias of file
Category/YYYY/MM/alias of file
Category/YYYY/MM/DD/file

I want to be above the Category and only find Category/YYYY/MM/DD/file.

Jolly Roger

unread,
Dec 20, 2009, 11:46:59 AM12/20/09
to
In article <bob-22F20F.1...@nntp.aioe.org>,
Robert Peirce <b...@peirce-family.com> wrote:

If you have Xcode installed, you can use /Developer/Tools/GetFileInfo
with the -a switch in your script to get a list of file attributes for
each file. If the returned attribute string contains a capital letter A,
the file is an alias file.

For example executing this command on an alias file should return a
attribute string containing the capital letter A:

/Developer/Tools/GetFileInfo -a my/known/alias/file

--
Send responses to the relevant news group rather than email to me.
E-mail sent to this address may be devoured by my very hungry SPAM
filter. Due to Google's refusal to prevent spammers from posting
messages through their servers, I often ignore posts from Google
Groups. Use a real news client if you want me to see your posts.

JR

Robert Peirce

unread,
Dec 20, 2009, 4:31:02 PM12/20/09
to
In article <jollyroger-6015F...@news.individual.net>,
Jolly Roger <jolly...@pobox.com> wrote:

> If you have Xcode installed, you can use /Developer/Tools/GetFileInfo
> with the -a switch in your script to get a list of file attributes for
> each file. If the returned attribute string contains a capital letter A,
> the file is an alias file.
>
> For example executing this command on an alias file should return a
> attribute string containing the capital letter A:
>
> /Developer/Tools/GetFileInfo -a my/known/alias/file

Thanks. That works (without the -a). Now I have to figure out the best
way to use it.

Robert Peirce

unread,
Dec 20, 2009, 6:16:03 PM12/20/09
to
In article <bob-A9478A.1...@nntp.aioe.org>,
Robert Peirce <b...@peirce-family.com> wrote:

> In article <jollyroger-6015F...@news.individual.net>,
> Jolly Roger <jolly...@pobox.com> wrote:
>

> > /Developer/Tools/GetFileInfo my/known/alias/file
>
> Thanks. That works. Now I have to figure out the best
> way to use it.

Turned out to be pretty simple. In ksh

if [ "$(/Developer/Tools/GetFileInfo "$1"|grep attributes|grep A) ]
then
exit
fi

apply-the-command "$1"

I could just as easily have used '!' and replaced exit with the command,
but I did it this way first and it worked. Then,

find . -name pattern -exec the-above-script {} \;

Jolly Roger

unread,
Dec 20, 2009, 9:48:26 PM12/20/09
to
In article <bob-A9478A.1...@nntp.aioe.org>,
Robert Peirce <b...@peirce-family.com> wrote:

Ermm... It works with the -a switch as well. In fact, the -a switch
makes it so that your script only has to look at *one* line of output as
opposed to several, so it's more efficient:

# GetFileInfo Home
file: "/Users/you/Desktop/Home"
type: "fdrp"
creator: "MACS"
attributes: AvbstClinmedz
created: 10/25/2009 10:49:14
modified: 10/25/2009 10:49:14

# GetFileInfo -a Home
AvbstClinmedz

0 new messages