Thread Dateinameliste und Größe? (5 answers)
Opened by Math55 at 2003-08-19 19:55

Strat
 2003-08-20 15:06
#69568 #69568
User since
2003-08-04
5246 Artikel
ModeratorIn
[Homepage] [default_avatar]
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
my &#36filename = '???';
my @filelist = qw(/usr/bin/perl /usr/local/bin/perl);

# suchmuster vorbereiten (ineffizient bei grosser @filelist)
my &#36searchString = join("|", map {quotemeta(&#36_)} @filelist);

unless (open (FILE, &#36filename)) {
  die "Error: couldn't read '&#36filename': &#36!\n";
}
else {

  while (<FILE>) {
    chomp(&#36_);

    my (&#36size, &#36filename) = split(/\s+/, &#36_, 2); # es koennen ja auch Leerzeichen im Dateinamen sein...

    if (&#36filename =~ /^(&#36searchString)&#36/o) {
     print "&#36filename: &#36size\n";
    } # if
    
  } # while

  close (FILE);
} # else
\n\n

<!--EDIT|Strat|1061377783-->
perl -le "s::*erlco'unaty.'.dk':e,y;*kn:ai;penmic;;print"
http://www.fabiani.net/

View full thread Dateinameliste und Größe?