"what I did wrong"

The learned choroba answered that question; your program lacked recursion. I recommend using Path::Iterator::Rule for this kind of recursive file-finding exercise. I like its compact and clear syntax, as shown in this simple demo:

use strict; use warnings; use feature 'say'; use Path::Iterator::Rule; my $dir = '1230046/public_html/software'; my $_numMissing = 0; my $_filesThere = 0; my $r = Path::Iterator::Rule->new->file->exists->and(sub { my $wanted = $_[0] =~ s!software/!!r; -e $wanted ? $_filesThere++ : $_numMissing++ && say "$wanted is mi +ssing"; })->all($dir); say " Found: $_filesThere"; say "Missing: $_numMissing"; __END__

Test directory structure:

ls -R 1230046 1230046: public_html 1230046/public_html: 42.txt 43.txt bar quux software 1230046/public_html/bar: 42.txt baz 1230046/public_html/bar/baz: 42.txt 43.txt 1230046/public_html/quux: 43.txt 1230046/public_html/software: 42.txt 43.txt bar foo quux 1230046/public_html/software/bar: 42.txt 43.txt baz 1230046/public_html/software/bar/baz: 42.txt 43.txt 1230046/public_html/software/foo: 42.txt 43.txt baz 1230046/public_html/software/foo/baz: 42.txt 43.txt 1230046/public_html/software/quux: 42.txt 43.txt

Output:

$ perl 1230046.pl 1230046/public_html/foo/42.txt is missing 1230046/public_html/foo/43.txt is missing 1230046/public_html/quux/42.txt is missing 1230046/public_html/foo/baz/42.txt is missing 1230046/public_html/foo/baz/43.txt is missing Found: 6 Missing: 6

Hope this helps!


The way forward always starts with a minimal test.

In reply to Re: Opening Directory and reading all file names and directory names by 1nickt
in thread Opening Directory and reading all file names and directory names by bizactuator

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.