Understand Symbolic link-Hard-link-Junction

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
binocular222
Posts: 1423
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Understand Symbolic link-Hard-link-Junction

Post by binocular222 »

From http://msdn.microsoft.com/en-us/library ... s.85).aspx
I understand that:
 Symbolic links: Link appear as though the file/folder actually exists at the location of the symbolic link (i.e files show same extension; file size, attribute…). All applications won’t know any different.
 Hard link: Symbolic links for file on same drive (volume).
 Junction (aka soft link): Symbolic links for directory (folder).
-------------------------
So, I can use Paste Special → Paste symbolic link (#270) in all cases, why I need to paste hard link or junction at all?
in List, symbolic links to file show file size = 0 while junctions show actual size of target. Is this intended?
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

xman
Posts: 133
Joined: 28 Nov 2009 22:57

Re: Understand Symbolic link-Hard-link-Junction

Post by xman »

I messed with this a few years back in one of my projects.

Symbolic links work only on Windows Vista and newer. They are generally preferable to other types, but on Win XP, you need to use junctions or hardlinks.

Both symbolic links and junctions don't update when their target is removed/renamed or when drive letter is changed. Instead, it seems that a new empty file is created when accessing such link. Hardlinks don't suffer from this and all copies always point to the right file and you can move and rename them however you like (at least as long as they are on one partition).

Symbolic links, unlike other types (I believe) support relative path, but not when created by XYplorer.

binocular222
Posts: 1423
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: Understand Symbolic link-Hard-link-Junction

Post by binocular222 »

Oh, thanks.
Seems that these features is not much useful due to their fragility
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

binocular222
Posts: 1423
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: Understand Symbolic link-Hard-link-Junction

Post by binocular222 »

How to edit symbolic link within XY?
I'm about to use relative path in symblink.
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Understand Symbolic link-Hard-link-Junction

Post by TheQwerty »

binocular222 wrote:How to edit symbolic link within XY?
I'm about to use relative path in symblink.
Currently this doesn't seem possible (and even difficult outside of XY).

A lot of suggestions seem to point users to the Link Shell Extension but I have no experience with it and thus cannot offer any guidance.

binocular222
Posts: 1423
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: Understand Symbolic link-Hard-link-Junction

Post by binocular222 »

Windows Vista+ has native mklink cmd command to create symlink.
I sucessfully created a relative one such as:
::run "cmd /c mklink /d ""<xyscripts>\theme\xxx"" ""..\Other"""
the xxx symblink correctly resolved to <xyscripts>\Other
But ::echo <prop #JunctionTarget>
show empty
a bug?

Another note:
XY can delete the xxx symlink file correctly (not delete souce)
but on copy/move (CtrlC/Ctrl X - Ctrl V), the source is moved instead of the symlink file

P.S This simple script edit current symlink file by delete old one then recreate

Code: Select all

	$CurItem = "<curitem>";
	$NewLink = input("Edit symblink",, <prop #JunctionTarget>);
	delete ;
	run "cmd /c mklink /d ""$CurItem"" ""$NewLink"""
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

Post Reply