# 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

Thread starter Title Forum Replies Date
Disk usage and hard links Support 16
TCC IDE Tabs - inactive tabs hard to see Support 14
Maybe Not So Hard Pdir Question Support 1
Attaching PowerShell changes its colors and makes it hard to read Support 15
Two hard to reproduce errors Support 0
Documentation Dangling links in the helpfile Support 4
I cannot use links to .btm files Support 5
7zip command links to zip help Support 0
Documentation Help: links to "Conditional expressions" don't work Support 2
Documentation v15 help: More mailto: links Support 2
Documentation v15 help: More odd mailto: links in the help Support 8
Documentation v15 help: Strange links in @INT topic Support 0
Documentation v15 help: Incorrect Links Support 0