[EMAIL PROTECTED] wrote:

> the program works fine for a small directory, but as soon as the
> directory is bigger, it takes a long time to start. do you have any
> idea how to make this faster?
>
> ---
>
> #!/usr/bin/perl
> use diagnostics;
> use strict;
> use Tk;
> use Tk::HList;
> use Tk::Tree;
> use File::Basename;
>
> my $mw = tkinit;
> my $hl = $mw->ScrlTree(-separator        => '/',
>                        -drawbranch       => 1,
>                        -scrollbars       => 'osoe',
>                        -selectmode       => 'extended',
>                        -selectforeground => 'red',
>                       )
>                 ->pack(-fill             => 'both',
>                        -expand           => 1
>                       );
>
> open SD,'</tmp/LIST' or die "Couldn't open all: $!\n";
> #my %hash = reverse map split, <SD>;
>
> my %hash = reverse map split, <DATA>; #<SD>;
> print "Datei '$_' belegt '$hash{$_}'.\n" for sort keys %hash;
>
> $hl->add('/');
> $hl->item('create', '/', 0, -text => '/');
> for my $file (sort keys %hash) {
>     print "file: '$file'\n";
>     my @path = split '/', $file;
>     shift @path; # leeren Eintrag vorn entfernen
>     print "path: '@path'\n";
>     my $path = "";
>     for my $pt (@path) {
>         print "inpatharray: $pt\n";
>         $path .= "/$pt";
>         print "path: $path\n";
>
>         if (! $hl->info('exists', $path)) {
>             my $realFile= fileparse($file);
>             if (-d $path) {
>                 $hl->add($path);
>                 $hl->item('create',
>                           $path,
>                           0,
>                           -text  => "$path",
>                           -image => $hl->Getimage('folder'),
>                          );
>                         $hl->autosetmode;
>             }
>             else {
>                 $hl->add($path);
>                 $hl->item('create',
>                           $path,
>                           0,
>                           -text  => "$path",
>                           -image => $hl->Getimage('file'),
>                          );
>                 $hl->autosetmode;
>             }
>         }
>         else {
>             print "weder noch\n";
>         }
>     }
> }
> ---
>
> to create the LIST file, simply do:
>
> du -h -a /usr> /tmp/all 2>/dev/null -->or /var or any big directory
> sort +1 /tmp/all > /tmp/LIST
>
> zhis should generate a file called LIST in the /tmp directory. i hope
> someone has an idea because this is really important.
>

The issue is performance?  Have you tried commenting out all print
statements?

Koseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to