Will anyone help me with this issue? These three lines of code work, but work in a way that I am not expecting. When I tell this module set prune to 0 it should NOT descend directories yet it does. Below are the 3 lines I have tried and below that is the entire script. thank you!

1) File::Find::find ( { wanted => $wanted, prune => $File::Find::prune + }, $fs ) ; 2) File::Find::find ( { wanted => $wanted, prune => +shift }, $fs ) ; 3) File::Find::find ( { wanted => $wanted, prune => $File::Find::prune = shift}, $fs

#!/usr/bin/perl use strict ; use warnings ; use File::Find ; use File::Find::Closures qw(find_by_min_size) ; ##-- Begin Format Code --## my ($key,$user,$grp,$mod,$sz) ; format STDOUT_TOP = Page @<<< $% FileName + Owner GroupOwner LastMo ate Size ========= + ======= =========== ====== ==== ===== . format STDOUT = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<< @<<<<<<< @<<<<<< @<<<<< <<< @##.### $key, + $user, $grp, date_m , $sz . ##-- End Format Code --## sub date_me { my $mod = shift @_ ; my ($seconds, $minutes, $hours, $day_of_month, $month, $year, undef, undef, undef) = localtime($mod) ; #printf("%02d:%02d:%02d-%02d/%02d/%04d", ( $hours, $minutes, $seconds, $month+1, $day_of_month, $year+1 +900 ) ; } my $log = qq(/var/adm/find_hog.log) ; my $logg ; open ($logg, '>>', $log) or warn "file '$logg' was not opened $!" ; START: print qq (\nPlease enter filesystem name in the form of /fsname or / j +ust for root\n) ; print "\n"; chomp (my $fs = <>) ; if ( $fs eq "/" ) { # only if the root directory, do not descend. find_me ( $fs, 0 ); } elsif ( $fs =~ m|^/\w+|i ) { ## matches /var find_me ( $fs, 1 ); } elsif ( $fs =~ m|^[/.\w+]|i ) { ## matches /.ssh find_me ( $fs, 1 ); } else { warn "\nFilesystem name does not match expression.\nPlease contac +t Unix on call and or try again\n goto START; } my ( @sorted_large_files, @large_files ) ; sub find_me { use Data::Dumper; my $fs = shift; #local $File::Find::prune = shift; ##-- localize prune to just thi +s block --## #my @directory = ($fs) ; use constant MAX_SIZE => (25*1024*1024) ; use constant DIVISOR => (1024) ; my ( $wanted, $list ) = find_by_min_size ( MAX_SIZE ) ; File::Find::find ( { wanted => $wanted, prune => $File::Find::prun +e }, $fs ) ; @large_files = $list->() ; @sorted_large_files = sort { -s $b <=> -s $a } @large_files ; } ##-- End sub --## if (@sorted_large_files) { my %meta ; for my $file (@sorted_large_files) { $meta{$file} = { 'uid' => (stat($file))[4], 'gid' => (stat($file))[5], 'sz' => (stat($file))[7], 'mod' => (stat($file))[9], } ; } ## END FOR ## for $key ( keys %meta ) { $user = getpwuid $meta{$key}->{'uid'} ; $grp = getgrgid $meta{$key}->{'gid'} ; $mod = $meta{$key}{'mod'} ; $sz = $meta{$key}{'sz'} / DIVISOR / DIVISOR ; #print "\n$key => $user\t$grp\t\t" ; #date_me($mod) ; #printf("\t%0.3f Mb\n",$sz) ; write ; } } ##-- End @sorted_large_files if --## else { warn "\nNo file(s) over twenty-five Mb found in $fs\n" ; exit 0 ; } END { close ($logg) or warn "Log '$logg' failed to close $!" ; }

In reply to File::Find::prune saga by mikejones

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.