Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Hard links - detecting their presence

Jun
121
0
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
 
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]
00500000:000DAD6E 00500000:000DAD6E

D:\Tmp>if %@inode[foo]==%@inode[bar] echo foo and bar are the same file
foo and bar are the same file
 
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
 

Similar threads

Back
Top