star7 has asked for the wisdom of the Perl Monks concerning the following question:
work on files in subdirectories --- How???#!/usr/bin/perl -w sub dir_explorer { my $dir = $_[0]; opendir(DIR,$dir) or die "Konnte Verzeichnis $dir nicht öffnen: $!"; my @verzeichnis = readdir(DIR); close(DIR); open(FILE,">output.dat"); foreach $entry (@verzeichnis) { if(-f $entry){ # formatieren($entry); print FILE "$entry ist ein file ! \n"; } else { print FILE "$entry ist ein directory ! \n"; dir_explorer($entry); } }; close(FILE); }; dir_explorer("/home/du/Stelle");
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: visit directories and more...
by little (Curate) on May 25, 2003 at 13:59 UTC | |
Re: visit directories and more...
by Abigail-II (Bishop) on May 25, 2003 at 14:04 UTC | |
File::Find::Rule
by barbie (Deacon) on May 26, 2003 at 09:23 UTC | |
Re: visit directories and more...
by star7 (Novice) on May 25, 2003 at 14:01 UTC | |
by WhiteBird (Hermit) on May 25, 2003 at 14:29 UTC | |
by star7 (Novice) on May 26, 2003 at 09:36 UTC |