4

I just created a hardlink in Windows 7 using mklink. When I use dir the output doesn't indicate that the new hardlink is a hardlink. Instead it looks exactly like the file it is pointing to.

Example output from dir:

05/16/2013  12:07 AM            40,448 HardlinkToOriginal
05/16/2013  12:07 AM            40,448 OriginalFile

On Windows 7 how do you check to see if a file is a hardlink?

I know that you can do: fsutil.exe hardlink list OriginalFile and this will tell you that HardlinkToOriginal is a hardlink, but you need a-priori knowledge that is not available. Ideally I would like something like ls -al on Linux where if the file is a link then the command tells you it is a link and shows you where it points to.

Arjan
  • 30,974
  • 14
  • 75
  • 112
Trevor Boyd Smith
  • 2,635
  • 11
  • 42
  • 60
  • 4
    I know that you can do: `fsutil.exe hardlink list OriginalFile` and this will tell you that HardlinkToOriginal is a hardlink, but you need a-priori knowledge that is not available. Ideally I would like something like `ls -al` on Linux where if the file is a link then the command tells you it is a link and shows you where it points to. – Trevor Boyd Smith Aug 13 '13 at 14:04
  • I guess this is what you are looking for: http://superuser.com/questions/366739/how-to-find-hard-links-on-windows `find . -links +1`. Additionally I want to mention the tool [ls.exe](http://schinagl.priv.at/nt/ln/ln.html#contact) which provides the same as `ls` on linux – nixda Aug 13 '13 at 14:18
  • 1
    Are you sure that `ls -al` *"shows you where it points to"* for *hard* links? (Surely, it does so for symbolic links aka softlinks.) – Arjan Aug 13 '13 at 14:32
  • 2
    @Arjan you are correct. On linux `ls -al` does not show hardlinks. You have to use the solution from the [superuser question here](http://superuser.com/questions/366739/how-to-find-hard-links-on-windows). – Trevor Boyd Smith Aug 13 '13 at 14:46

1 Answers1

-1

I don't believe you can. In fact, if you delete OriginalFile, you'll still have HardlinkToOriginal available.

Jack
  • 1,303
  • 8
  • 7