in reply to Problem stripping directory listing
try `find /home/sites/$arg1/users -type d -maxdepth 1`.
this might be the more perlish way...
my $which_site = shift @ARGV or die "Usage: $0 <sitename>\n"; my $home = "/home/sites/$which_site/users"; use Cwd; my $old_cwd = cwd(); # keep current working directory chdir $home or die "Can't chdir: $!\n"; opendir(HOME, '.') or die "Can't opendir: $!\n"; my @users = grep { !/^\./ # skip any .file_or_dir esp . and .. and -d # is it a directory? } readdir(HOME); closedir(HOME); # go back to where we started chdir $old_cwd or die "Can't chdir: $!\n"; print join "\n", @users, '';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Problem stripping directory listing
by valdez (Monsignor) on Feb 15, 2003 at 12:04 UTC | |
|
Re: Re: Problem stripping directory listing
by jdporter (Paladin) on Feb 15, 2003 at 13:11 UTC | |
by zengargoyle (Deacon) on Feb 15, 2003 at 14:02 UTC |