Re: find2perl



-

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 to set
no_chdir to 1 it should NOT descend directories yet it does. Am I
supposed to have a wanted routine other than whats below? Below are the 3
lines I have tried and below that is the entire script.

thank you!

1) File::Find::find ( { wanted => $wanted, no_chdir =>
$File::Find::no_chdir }, $fs ) ;

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

3) File::Find::find ( { wanted => $wanted, no_chdir =>
$File::Find::no_chdir = 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) ;

<snip>

##-- 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+1900 ) ;
}

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 /
just 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 contact
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 this
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, no_chdir => +shift }, $fs )
;
@large_files = $list->() ;


@sorted_large_files =
sort { -s $b <=> -s $a }
@large_files ;

} ##-- End sub --##

<snip>

--



Will / Can anyone help, pretty please?








____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
.



Relevant Pages

  • Re: Help with simplifying my Code
    ... Hi, does this code work? ... Instead use MePRICE1 Is Null or IsNull ... Sub PRICE() ... For intCount = vintIndex To 10 ...
    (microsoft.public.access.formscoding)
  • Re: Help with simplifying my Code
    ... > Hi, does this code work? ... > Sub PRICE() ... > Dim intCount As Integer ... Thanks Graeme ...
    (microsoft.public.access.formscoding)
  • WHY, WHY WONT IT WORK???
    ... For some reason I just can't get this piece of code work! ... Public Class Webdefault ... #Region " Web Form Designer Generated Code " ... End Sub ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Disappearing GridView - Newsgroup???
    ... missing from the code and why shouldn't the code work? ... The GridView disappers because it is empty. ... You don't need to process PageIndexChanging event, ... Sub Page_Load ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Get Application Hwnd
    ... >Also your CODE work fine, ... >instead of matrix or Array, ... I hate collections ...
    (microsoft.public.vb.winapi)