http://www.perlmonks.org?node_id=1223827


in reply to <JUNCTION>; how to recognize

fatkatie:

I don't know of any current perl modules or API that would let you work with junctions. If you can't use "dir /aL" to find the information you want, then try Googling "reparse_point", as it seems that Junctions are a specialization of Windows Reparse Points.

I did a little work with them a couple years ago, but didn't dig into it too deeply. If you're just wanting to detect whether a file is a reparse point, though, you should be able to do so with Inline::C. A little of the C code I used to detect reparse points is:

#include <windows.h> #include <winbase.h> int is_reparse_point(const char *file_name) { WIN32_FIND_DATA file_data; HANDLE fHandle = FindFirstFile(file_name, &file_data); // If we can't open the file handle, we'll just say it's not a rep +arse point if (fHandle == INVALID_HANDLE_VALUE) return 0; // Convert the bit into a 0/1 value return !!(fHandle.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) +; }

Note: I just trimmed this out of an old project, and I don't have the time right now to put it together into a simple perl module, but if you want to pursue this, ping me if you have any troubles, and I'll lend a hand.

...roboticus

When your only tool is a hammer, all problems look like your thumb.