Hard links - detecting their presence

Stephen Howe

Hi

How do I know if a file is a hard link?
It does not seem detectable in TCC
Neither ATTRIB nor a DIR switch seems to show up anything.

Thanks

Stephen Howe

dim

Dimitry Andric
How do I know if a file is a hard link?
It does not seem detectable in TCC
Neither ATTRIB nor a DIR switch seems to show up anything.

You cannot find out (easily) which other links a certain file has, but it is easy to see if two (or more) files are hard linked together, using the @INODE function:

Code:
D:\Tmp>echo foo > foo

D:\Tmp>mklnk foo bar
D:\Tmp\bar -> D:\Tmp\foo

D:\Tmp>dir foo bar
2009-05-06  20:28               5  foo
2009-05-06  20:28               5  bar

D:\Tmp>echo %@inode[foo] %@inode[bar]

D:\Tmp>if %@inode[foo]==%@inode[bar] echo foo and bar are the same file
foo and bar are the same file

Steve Fabian

dim wrote:
| ---Quote (Originally by Stephen Howe)---
| How do I know if a file is a hard link?
| It does not seem detectable in TCC
| Neither ATTRIB nor a DIR switch seems to show up anything.
| ---End Quote---
| You cannot find out (easily) which other links a certain file has,
| but it is easy to see if two (or more) files are hard linked
| together, using the @INODE function:
...

and the @links[] function tells you how many directory entries exist for the
file (i.e., it can be used to determine whether or not any other "file"
(i.e., directory entry) is hard linked the file of interest.
--
HTH, Steve