Leser: 2
|< 1 2 3 4 5 >| | 44 Einträge, 5 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use strict;
use warnings;
use Cwd;
my $dir = cwd;
opendir (DIR, $dir) || die $!;
my @files = readdir (DIR);
closedir (DIR);
{
local ($\,$,) = ($/, $/);
print @files;
}
./prog.pl | less
1
2
3
4
5
6
Argument "." isn't numeric in sort at ./filesize2.pl line 36.
Argument ".." isn't numeric in sort at ./filesize2.pl line 36.
Argument "filesize2.pl" isn't numeric in sort at ./filesize2.pl line 36.
Argument "make_index.pl" isn't numeric in sort at ./filesize2.pl line 36.
Argument "lol.htm" isn't numeric in sort at ./filesize2.pl line 36.
Argument "omake.cpp" isn't numeric in sort at ./filesize2.pl line 36.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/perl
use strict;
use warnings;
use Cwd;
my $dir = getcwd;
my %sizeindex;
my %fileindex;
my @sort;
my $o;
my @size;
opendir(FILE, "$dir");
my @file = readdir(FILE);
closedir(FILE);
foreach(@file)
{
my $size = (-s, "$_");
push @size, $size;
$sizeindex{$_} = $size;
}
foreach(@size)
{
my $i = 0;
$fileindex{$i}=$sizeindex{$file[$i]};
$i++;
}
my $main = @file;
@sort = sort { $a <=> $b } @size;
format STDOUT_TOP =
Dateiname Dateigroesse
====================================
.
for($o = 0; $o == $main; $o = $o + 1)
{
if (-f "$_")
{
my $i = 0;
if ($size[$i] < 1024)
{
$size[$i] .= " bytes";
} elsif ( $size[$i] > 1024 && $size[$i] < 1048576)
{
$size[$i] = sprintf("%.2f", $size[$i] / 1024);
$size[$i] .= " kb";
} elsif ( $size[$i] > 1048576 && $size[$i] < 1099511627776)
{
$size[$i] = sprintf("%.2f", $size[$i] / 1048576);
$size[$i] .= " mb";
} else
{
$size[$i] = sprintf("%.2f", $size[$i] / 1099511627776);
$size[$i] .= " gb";
}
format STDOUT =
@<<<<<<<<<<<<<<<<< @>>>>>>>>>>>>>>
$fileindex{$i}, $size[$i]
.
write;
$i++;
}
}
my $size = (-s, "$_");
my $size = -s $_;
my $size = -s;
my $size = (-s $_, $_);
my($size) = (-s $_, $_);
$fileindex{$i}=$sizeindex{$file[$i]};
|< 1 2 3 4 5 >| | 44 Einträge, 5 Seiten |