Okay, in the end I used strat's line of code within a loop to test for each directory.
I tried crazyinsomniac's code, which only printed out one filename in a directory not even included in the path. I probably used it wrong!
So anyway, thanks a lot for your help (and that includes everyone that posted).
I would post the code I now use, but it's quite long... And sorry about the use of HTML there... I noticed that it shrunk the size of the nodelets after I posted it.

Update: Okay, I tried crazyinsomniac's code again, and it worked for the most part, but it still left valid directories out of the options, so I went back with strat's code with a small modification. Here is the code I use now:

my $root_path = "C:/Apache/www-root"; my $count = 0; my $dir = ""; my @dirs find(\&{ sub { if (-d "$File::Find::dir/$_"){ if (++$count == 1) { push @dirs, $File::Find::dir; } else { push @dirs, $File::Find::dir . "/" . $_; } } } }, "$root_path"); foreach $dir (@dirs) { my $tmp_dir = $input{'file' . $i}; my $tmp_dir =~ s/(.*)\/(.*)/$1/; if ($test_this_directory !~ /^\Q$full_file_path/ && $dir ne $tmp_ +dir) { #valid directory - add it to cpoy options } }

In reply to Re: Is this directory a subdirectory of another directory? by mt2k
in thread Is this directory a subdirectory of another directory? by mt2k

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.