Following my link, and doing some more research, I eventually found https://github.com/dagolden/Path-Tiny/issues/160, which gave a function which spawns out to the cmd.exe DIR /AL command to find junctions and symlinks: so that could work. But it also pointed to Win32API::File, which has GetFileAttributes() and the FILE_ATTRIBUTE_REPARSE_POINT constant, which yields a solution for recognizing/identifying windows junctions:
use Win32API::File qw'GetFileAttributes :FILE_ATTRIBUTE_';
sub isjunc {
return (GetFileAttributes($_[0]) & FILE_ATTRIBUTE_REPARSE_POINT ==
+ FILE_ATTRIBUTE_REPARSE_POINT) ? 1 : 0;
}
(I know, it could be simplified to sub isjunc { GetFileAttributes($_[0]) & FILE_ATTRIBUTE_REPARSE_POINT }, but I like making things more explicit.)