Thread Alle Dateien eines Formats suchen...
(13 answers)
Opened by KarlaCluft at 2013-01-27 18:54 Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 use strict; use warnings; my $path='/home/backup/'; opendir(my $dh, $path) or die("Can't open dir $path"); while( my $file=readdir($dh) ) { my $file_path=File::Spec->join($path,$file); next unless -f $file_path; print "$1\n" if($file=~/([^.]+)$/); } closedir($dh); oder Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 use strict; use warnings; my $path='/home/backup/'; opendir(my $dh, $path) or die("Can't open dir $path"); while( my $file=readdir($dh) ) { my $file_path=File::Spec->join($path,$file); next unless -f $file_path; my $ending=(split(/\./,$file))[-1]; print "$ending\n"; } closedir($dh); |