in reply to losing files when run from /
#!/usr/bin/perl -w use File::Spec::Functions qw(catfile); use strict; my @users = qw(/home/zentara); foreach $homedir (@users) { my $dh; opendir $dh, $homedir or warn "Cannot readdir $homedir:$!\n"; my @files = grep /\A[^.]/ and -f catfile($homedir, $_), readdir DIR; print "@files\n" . "#"x47 ." \n"; } exit;
File::Spec::Functions provides importable versions of File::Spec's crossplatform functions for de/constructing pathnames. These modules are in the Perl core.
Update: s/readdir DIR/readdir $dh/
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: losing files when run from /
by chanio (Priest) on Jul 27, 2005 at 19:55 UTC | |
by Aristotle (Chancellor) on Jul 27, 2005 at 20:34 UTC |