Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: <JUNCTION>; how to recognize

by pryrt (Prior)
on Oct 10, 2018 at 18:53 UTC ( #1223822=note: print w/replies, xml ) Need Help??


in reply to <JUNCTION>; how to recognize

here is a post I have bookmarked on junctions. I've never found the Round Tuit to use that as a starting point for updating some of my personal scripts which could benefit from being able to recognize junctions1... so hopefully this link will help you get started down the right path.

update 1: this started as a fully fledged thought, but apparently didn't get fully typed: "...recognize junctions, so I don't have the expertise to help you any further... so hopefully..."

Replies are listed 'Best First'.
Re^2: <JUNCTION>; how to recognize
by pryrt (Prior) on Oct 10, 2018 at 21:08 UTC

    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.)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1223822]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2019-12-09 07:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?