use strict; use warnings; #---to configure--- #MySQL DB setting my $user = 'bla'; my $password = 'bla'; my $host = 'localhost'; my $database = 'bla'; my $table = 'bla'; #else my @paths = ('/home/matthias/Videos','/mnt/next/g/multimedia/filme','/home/matthias/ttt'); my @fileformats = ('avi','mpg','mpeg','bin'); #---to configure end--- my $check; my $file; for my $path (@paths) { if(-d $path){ search($path); }else{ logP->wirteLog("Path ".$path." don't exist\n"); } } sub checkFileFormat{ my $file = shift; for my $fileformat (@fileformats){ if($file =~ m/($fileformat)/){$check=1;} else{$check=0;} } } sub search{ local *DIR; my $path = shift; opendir(DIR,$path); while($file = readdir(DIR)) { if(($file ne ".") && ($file ne "..")){ if(-d $path."/".$file){ search($path."/".$file); }else{ checkFileFormat($file); if($check==1){ print($check." ".$path."/".$file."\n"); }else{ print($check." ".$path."/".$file."\n"); } } } } closedir(DIR); }