On Tue, Aug 30, 2005 at 01:31:12PM -0400, Guy Dallaire wrote:
> 2005/8/30, Graeme Humphries <[EMAIL PROTECTED]>:
> > 
> > >And is there a way to find the number of HARD links ?
> > >
> > >
> > Find should do this... let's see... Yep, according to "man find", %n in
> > its internal printf will give you the number of hard links to a file.
> > So, something like this should give you useful output about what files
> > have multiple hard links:
> > 
> > find . -printf "%n %p\n" | sort -r
> > 
> 
> Unfortunately, looks like sun's find command does not have the printf
> option built in. What is strange tough is that if I do a "find /disk1
> -links +1" I find a LOT of files. According to find's man page, the
> links +1 parameter predicate is true if file has n links....
> 

If you load the companion CD software that came with your Solaris distro
you will also have a gfind (gnu find) command.  Also obtainable from
blastwave.org and others.

Then to get a count you could do something like:

        gfind . -type f -links +1 -printf '%i\n' | sort | uniq | wc -l

With the Solaris (POSIX) or gnufind find try:

        find . -type f -links +1 -ls | cut -d' ' -f1 | sort | uniq | wc -l

-- 
Jon H. LaBadie                  [EMAIL PROTECTED]
 JG Computing
 4455 Province Line Road        (609) 252-0159
 Princeton, NJ  08540-4322      (609) 683-7220 (fax)

Reply via email to