Column: Link2Volume (volume data for links and shortcuts)

Link2Volume - A column set which provides volume data (size, free space, drive letter etc.) for all symbolic links, junctions, mountpoints and shortcuts to local or remote locations like shares, folders, unc-paths, regular volumes, file-system mounted volumes etc.

Description:
As I use mountpoints and symlinks quite a lot, I hooked onto an idea which came up here: Display/treat regular folder as My Computer.
The columns follow any link recursively, so in case you have a shortcut (*.lnk-file) pointing to a junction, which then again points to a mountpoint on a remote machine, you will get all information from the volume on the remote machine, displayed for that locally stored shortcut. I did not try all possible chainings, but it looks very promising. o)

Demo:
Notice, this is not the regular "My Computer" folder.
It is just a regular folder containg all sorts of different link types to a wild mixture of local/remote locations and volumes.



Hint:
To resolve some links "fsutil.exe" and WMI is used. On my system it took some additional firewall rules to allow outgoing WMI connections. If you get an "Access denied" error message in the log (console), it's not necessarily a missing permission on your remote system. In case you have trouble with specific locations, check the log and maybe raise the loglevel to "dump" in the script config.

HowTo:
..create a symbolic link, junction or mountpoint?
Search the web for "mountvol.exe", "mklink.exe", "fsutil.exe" and general windows disk management for instructions and use cases.
DO also allows to create various kind of links with the "Copy MAKELINK" command, refer to the manual for more.

Installation:
To install the columns, download the *.js.txt file below and drag it to Preferences / Toolbars / Scripts.
After that, right click any listers column header and add the columns from the "script" submenu.

Download:

1 Like

Nice :slight_smile:

Thanks! o)

Still some todos left I think:

  • limit resolving of volumes to folders only (disable support for *.lnk files)
  • blacklisting of specific paths
  • localization

Any feedback welcome, especially in terms of performance. For some cases the script queries WMI three times in a row.
Though there is caching for the WMI result built-in, refreshing can still result in some noticeably delays.

Another thing to explore is: Why is there an "Access Denied" for most of the junctions created by windows?
Follwing paths e.g., do not resolve by "fsutil.exe" to their target for me (although DO can):
"C:\Documents and Settings", "C:\Programme"

"Zugriff verweigert" == "Access denied":


Oh, the "Access Denied" thing can easily be cured by editing the security settings on those folders, too obvious! o)
Still wonder why DO is able to resolve those targets, doesn't it run in my users context?

Windows intentionally permissions the hidden+system junctions like "C:\Documents And Settings" in that way.

They exist for backward compatibility with poorly written software (which uses hardcoded paths instead of looking up the paths via the API). The permissions stop tools from accidentally recursing into the junctions, e.g. when backing up or searching data, since it would result in the same things being returned twice, and infinite loops in some cases. The folders are hidden+system so that normal users never see them, and they are best ignored.

You probably shouldn't modify those permissions as they are there to protect against problems.

The permissions do not stop the targets being resolved, which is why Opus is able to. fsutil must be trying to do more than just resolve the target when it fails.

Makes sense! I forgot that these folders are hidden normaly. So, no more security issues, fine! o)
Ok, fsutil.exe works for all other links at least, so whatever it stops it from working on these hidden/system-folders shouldn't really matter. Thanks! o)

This reminded me of a question I had in the past: There's no way to query from script, what DO can fetch for an item in a specific column, right?
Then I could simply use what DO spits out as "Target", instead of making use of an external tool to resolve it.
There really is valuable information in all these DO columns, which is hard to get via scripting alone or even with external helper tools!!! o)

Inside Opus and on Windows I always use:

Copy MAKELINK=softlink

See also: Making Links and Junctions in the manual.

Yes, playful. You can of course make use of the internal DO command to create links! I'll add that to the tiny "HowTo".. o)

I recently decided to go the way of NTFS mount points instead of drive letters and found this script immensely helpful. It seems to be working however it generates some errors in the console which I cannot pin point exactly.

 2017-12-13 13:22 Column.Folder: Link2Volume:  Column_Link2Volume(): [A Elements]
 2017-12-13 13:22 Column.Folder: Link2Volume:  Column_Link2Volume(): [A Elements]
 2017-12-13 13:22 Column.Folder: Link2Volume:  Error at line 251, position 3
 2017-12-13 13:22 Column.Folder: Link2Volume:  Subscript out of range (0x800a0009)
 2017-12-13 13:22 Column.Folder: Link2Volume:      Column_Link2Volume(): [A Elements]
 2017-12-13 13:22 Column.Folder: Link2Volume:  Error at line 251, position 3
 2017-12-13 13:22 Column.Folder: Link2Volume:  Subscript out of range (0x800a0009)
 2017-12-13 13:22 Column.Folder: Link2Volume:          Column_Link2Volume(): [A Elements]
 2017-12-13 13:22 Column.Folder: Link2Volume:  Error at line 251, position 3
 2017-12-13 13:22 Column.Folder: Link2Volume:  Subscript out of range (0x800a0009)
 2017-12-13 13:22 Column.Folder: Link2Volume:              Column_Link2Volume(): [A Elements]

I'm thinking of implementing a global caching mechanism for storing the values indefinitely and only updating on demand as the content in those drives is changed not so often. That way I wouldn't have to re-query the info every time when navigating to the folder containing the links which would prevent the attached drives from waking up on said navigation.

I'm so sorry to warm-up this ancient topic... but as I searched for a way to get free space information for drives used with mount points instead of being used with driveletters within DOpus 13.x I came over link2volume and didn't find anything else. The desired built-in colums therefore are only be offerd on the "My Computer"-Level, not as being in a folder with that junction links.

I use external drives as symbolic links created in one special folder. Link2volume successfully shows up that infos.


To get a complete overview of existing sources I also put a link to NAS-Shares but it's not able to follow sources to UNC-Shares. Links to NAS over a driveletter are working nearly as desired, only foldersize won't be calculated

At bottom right of lister windows an error will be shown and log states:

Am I totally wrong with my try to build my "customized My-Computer Overview" in that way, because DOpus 13 has a solution for that I did'nt found?

I don't think DO has a solution yet.

Did you modify the script add in? At least the Line telling about "cache being undefined" -> 'cache' ist undefiniert, seems to be an oversight in the script, the var "cache" is indeed not defined in that GetShares() function, but it is also not used, probably a copy and paste error.

Not sure what's going on for you in line 251.. I have text translations in that area (but the user posting before you some years ago, obviously had the same problem. Man, time is flying! o))
"column.percentfull.label" : "L2V.Percent Full",

I had a quick test, the columns "kinda" still work, but show the wrong size for the type of links I use currently (link to UNC, which is a folder on a drive and the drive is mounted to folder on another drive). I seem to get correct size information by "opening" these links and just looking at the status bar though, so it should be possible to determine the correct drive / size behind these links too.

Maybe parts of the logic hunting down links and volume information was always faulty, idk, but WMI is still a thing, so whatever does not work now or works differently with Win10+ (I used Win7 back then), there is probably a fix for that somewhere in these 1000+ lines! o)

May I ask, what type of link are you dealing with? I might be able to reproduce your issue, which might help as long as there are no DO native columns to handle these links.

yeah, time's running like hell :). I had my first DOpus running on Amiga end of the 80s...

I didn't change anything at your script, 'cause I'm not familiar with jscript.

My point is not the cache thing, just the impossibility to get the information of the UNC-links. Those links have been done in the standard way - but leads to a share located on my synology NAS. I've gone to the NAS by using the windows explorer, showing all shares located there and made a link to one particular share within that local folder where my junctions to the local drives are being located with dropping that that share by using right mouse button and "make link".

As I actually tried a UNC to a windows share - that works!

see:


from top to below:

  • link to attached share (Synology) to driveletter B:
  • link to UNC share (synology)
  • link to UNC share (windows)

For me that looks like your script cannot follow UNC-links to systems being located on a linux (Synology) based system as it states "cannot query win32_share: remoteservercomputer doesn't exist or isn't available"

The size column is the DOpus integrated column - looking nice 'cause of the bar inside - but not too important as your used space column brings up the right size, like the Percent Full column does.

Brilliant script tbone - couldn't ask for more. Frankly the Label, Size, Used Space, Free Space and Percent Full colums should be built into DOpus :sunglasses: