in reply to Directory checking on Windows XP

What is in $entry?

If for example, $entry is being obtained from an environment variable set up manually using tab completion to generate the path like this:

set SOME_ENV_VAR="c:\some\path"

Where most native programs and utilities will accept and ignore/discard the quotes, Perl doesn't. Getting rid of the quotes in the environment variable will fix the problem.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^2: Directory checking on Windows XP
by ack (Deacon) on Sep 22, 2008 at 05:37 UTC

    Excellent question. I have posted an update to my original node and have included the code.

    $entry specifies and entry from a directory with a full directory path name...for example as follows (NOTE: THISDIR is the directory handle from an opendir() on the $top_dir):

    $top_dir = "C:/Blah/"Blah Smah"/Blahdie/"; @all_entries = readdir(THISDIR); foreach my $the_entry (@all_entries) { $entry = $top_dir . $the_entry; if(-d $entry) { <do something> } else { <do something else> } }
    ack Albuquerque, NM