Skip to content

fs.lstat and fs.readlink not recognizing symbolic links in Windows #50722

Answered by kshetline
kshetline asked this question in General
Discussion options

You must be logged in to vote

Apparently I was wrong about Explorer somehow being aware of symlinks, and being able to use them.

What's going on is that, as far as Windows is concerned, or any consumer of the SMB volume, the symlink to a file IS that file, and the symlink to a directory IS that directory. It's impossible to distinguish between a link and the target to that link.

Fortunately for me, the code I'm writing, while being tested on Windows, will run in a Linux environment on Docker when deployed. For testing purpose, this ugly hack helps:

find . -type l -exec echo {} \; -exec readlink {} \; > symlinks.txt

I run the above command on my Unraid server to build a symlink lookup at the root of the volume. Instead…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kshetline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant