Code: -------------------- use strict; use File::Find; my @parts; my $command; my $numfiles=0; my $numdone=0; open LOG, ">", "flactest.log"; printf (LOG "Starting testing of flac files\n"); find (\&filecount, "."); printf (LOG "Found %d files to test\n", $numfiles); find (\&flactest, "./"); printf (LOG "Testing of files has finished.\n"); close LOG; sub flactest { if (-f $_){ @parts = split /\./, $_; if ($parts[$#parts] eq "flac"){ printf (LOG "Testing file %s (%d of %d, %d%% done)\n", $File::Find::name, $numdone, $numfiles, $numdone/$numfiles*100); $command = "flac -t " . "\"" . $_ . "\"" . "\n"; # printf ("Executing the following command: %s\n", $command); system ($command); if ($? != 0){ # printf ("Testing of %s FAILED!!!\n", $File::Find::name); printf (LOG "***Testing of %s failed\n", $File::Find::name); } else{ # printf ("Testing of %s passed\n", $File::Find::name); } $numdone +=1; } } } sub filecount { if (-f $_){ @parts = split /\./, $_; if ($parts [$#parts] eq "flac"){ $numfiles += 1; } } } --------------------
------------------------------------------------------------------------ maggior's Profile: http://forums.slimdevices.com/member.php?userid=9080 View this thread: http://forums.slimdevices.com/showthread.php?t=97923 _______________________________________________ unix mailing list unix@lists.slimdevices.com http://lists.slimdevices.com/mailman/listinfo/unix