Hello,

I currently have a program that will search through a given directory and will collect all the sub-directories (folders) and their timestamps. I use this to see if any folders have been added/changed/deleted. It works beautifly, except it doesn't work for a folder that is actually a shortcut to another folder.

I was looking at Detecting if a folder is a symbolic link and thought maybe the -l (symbolic link) check might work for this, but it doesn't. I want to do some kind of check to see if it is a shortcut or not.

Another idea I had to solve this is to somehow identify the type of file it is, but I am having a hard time finding how to do this as well.

This is what my code looks like right now.

if (-d $directory) { #continue processing } else { print "$directory does not exist"; }
With this code, the shortcut folders say that the directory does not exist. I want to make another section so my code does something like this:
if (-d $directory) { #continue processing } elsif (SOMETHING) #if it is a shortcut { print "$directory is a shortcut. Will not process."; } else { print "$directory does not exist"; }
Any ideas what that SOMETHING could be?

I am using Windows OS.


In reply to Determining if folder is a shortcut by atyrrell

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.