Chad Kellerman wrote:
>
> Hi everyone,
Hello,
> I am having a small problem with opendir:
>
> #!/usr/bin/perl -w
>
> # getting disk usage for users
> # not quite as good as du(1) but alittle faster...maybe
> # written by [EMAIL PROTECTED]
> # Aug 17, 2002
>
> use strict;
> use diagnostics;
> $|++;
>
> my ( $name, $uid, $dir );
> while ( ( $name, undef, $uid, undef, undef, undef, undef, $dir ) =
> getpwent()) {
> next if ( $name =~ /users/ || $name =~ /www/ || $name =~ /sysop/);
> if ( $uid > 500 ) {
> if (-l $dir ) { $dir = "/home2/$name"};
> my $maildir = "$dir/\*\-mail/";
> print "$name has $dir and $maildir\n";
> opendir( MAILDIR, "$maildir" ) || die "what the: $!";
> my @mail = grep -T, readdir MAILDIR;
> closedir MAILDIR;
> print "@mail\n";
> }
> }
>
> This code dies on the opendir statemenet saying that /home/$name/*-mail
> is not there. But it is there. What else can I use for the "*" so that
> it will read the mail direcotry for a user?
I tried this on my system:
$ mkdir \*-mail
$ touch \*-mail/one
$ touch \*-mail/two
$ touch \*-mail/three
$ ls -lR
.:
total 1
drwxr-xr-x 2 john users 94 Nov 20 12:03 *-mail
./*-mail:
total 0
-rw-r--r-- 1 john users 0 Nov 20 12:03 one
-rw-r--r-- 1 john users 0 Nov 20 12:03 three
-rw-r--r-- 1 john users 0 Nov 20 12:03 two
$ perl -le'$d = "*-mail";opendir D,$d or die"$!";while($f=readdir
D){print"F:$f"}'
F:.
F:..
F:one
F:two
F:three
What is the _exact_ error message that you are getting?
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]