Sorry for the delay in posting summary. See my summary on mailtool
defaults for my lame excuse. :-)
Original query:
>One of our systems designers came up with a question that I can't
>answer (nothing new there). I can't vouch for the application being
>developed, but the designer says that it will need to remove files and
>should clean up any links that may point to the file. The question is
>"How can the application check that there are no links pointing to the
>file to be removed?"
>
>The second field in the 'ls -l' output is described as 'number of links'
>but when I looked for an explanation of what exactly that means, I found
>nothing. I tried comparing a number of 'ls -l' outputs but couldn't
>conclusively determine what the field was telling me. It seems to have
>something to do with directories however, not links.
>
>I'm sure this could be done with find, but the designer was hoping for
>something a bit faster.
>
Several responses ranged from overviews to detailed tutorials. Thanks
one and all. They helped to clarify what I had read and validate what I
had surmised.
Some, rightfully in my opinion, questioned the application that needed
such a function suggesting that said app should better manage the links
from the start. No argument there; all responses were forwarded
unedited to the developer (let y'all do my dirty work for me :-) ).
Now for the summary:
Hard links can be traced backwards. The 'ls -i' command provides the
inode for the file, then 'ncheck -i' lists the files with hard links to
that inode.
Soft (symbolic) links cannot be traced backwards. The only way to
locate these, other than properly managing them in the first place, is
to search the entire file system in question using a tool such as find.
Thanks to:
dmur@bssssq.edu.au
Peter.Bestel@uniq.com.au
ric@rtd.com
gunn@lardav.com
jsgilli@lookout.ecte.uswc.uswest.com
stanley@oce.orst.edu
sweh@mpn.com
perryh@pluto.rain.com
mayank@mss.mss.com
bob@singapore.geco-prakla.slb.com
Kevin.Sheehan@uniq.com.au
delliott@src.umd.edu
tfb@ed.ac.uk
martin@vine.co.uk
paul.crutchley@csc-eng.demon.co.uk
bern@ti.uni-trier.de
danny@esaserv1.dseg.ti.com
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:30 CDT