in reply to Bloated File Detector for Unix Boxes

I'm not sure what -depth is doing in your "find" line, but you can pull all that finding stuff inside your Perl code with:
use File::Finder; my @bloatedFiles = File::Finder ->size('+8192') ->not->name(qr/back|archiv|ora?/) ->collect(sub {[$File::Find::name => -s _]}, '/'); @bloatedFiles = map $_->[0], sort { $b->[1] <=> $a->[1] } @bloatedFile +s; splice(@bloatedFiles, 100) if @bloatedFiles > 100;

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re^2: Bloated File Detector for Unix Boxes
by bpoag (Monk) on Mar 15, 2005 at 15:51 UTC
    Hi merlyn, The -depth flag is just a personal preference -- It traverses the directory's contents before searching the directory itself. There are ways to fine-tune find, to tell it how many directories deep you want it to go. -maxdepth and -mindepth, iirc.
      I'd understand it as a preference if it in fact did something useful for your application here. But it does nothing. It's like throwing "/o" on the end of a regular expression that contains no variables. It's pointless.

      That's why I wondered why you did it. You're doing nothing. It'd be like having an extra variable declared, and initializing it, only to never use it again in your program. You're going to extra work to do something that does nothign.

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.

        Ahha, I misunderstood you. You are correct--there is no functional difference between having -depth, and not having it. Good catch! :)