using find to locate hard and soft links with tar

I am digging for certain types of files in the current directory and all its sub-directories and archiving them with the following code:

#! /usr/bin/ksh

Archive=`date +%Y_%m_%d_%T`
find . -type f \( -name \\.ksh -o -name \\.sql -o -name \*\.ini \) -print|xargs tar -cf configksh_$Archive.tar

rm -rf $Archive
The problem with this piece of code I have is that-- I can't locate the links (symbolic / hard / soft.. I'm not sure of the difference either) of the resultant files.

Can somebody throw light on how I can "find" all the links recursively within the current directory along with the files that are of the desired extensions as shown. (Links , obviously, needn't have these extensions).

Correct me if I'm wrong in saying:

find . \( -type f -o -type l \) \( -name \\.ksh -o -name \\.sql -o -name \*\.ini \) -print|xargs tar....

to do what I want.

Thanx to all who save me quickly,
Sirisha

C'mon ppl.. it's about 20 hrs and not a single reply?!

I'm really desperate to get this right as early as possible..
I understood from a lot of posts here that there is no direct way to find hard links...except with the help of inode number. For soft links the "l" predicate in the list of file permissions when issued a "ls -l".. may help..

but i just want to confirm if i'm thinking in the right direction.

Can files of the required extensions be identified along with their links(hard or soft) using find command? If so, please enlighten me how.

Thanks a ton in advance,
Sirisha

manthasirisha,

Please note that we are not obligated to reply to your posts. Everyone on this forum has a job as a sysadmin, or a programmer or are students and are helping out on the forums in their free time.

You have already used the find command with the type predicate. Use the same command:

find . -type l -exec ls -l {} \;

This find will list all files that are soft (symbolic) links. Is this what you want?

Blowtorch,

I never did say anything like that.. nor even did I mean when was asking help for a second time. It was a very informal and casual expression I thought, could use to request our expert friends from such a hyooooooge group. It wasn't meant to obligate anyone here to respond to it all.. it's a just a plain and urgent request! Sorry, if you felt it personal.

Thanks a ton for your advice on that! But that's not all that I'm looking for. I need a short method by which I can extract the files I need and follow up both their hard and soft links.

Hope I made myself thorougly clear!

Sirisha

If you are using GNU-find: use the "-follow" clause to dereference the links if this is what you want to do.

More on this could be found at "man find".

bakunin