in reply to Is this directory a subdirectory of another directory?
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 } }
|
|---|