#!/usr/bin/perl $inpath = "/tmp/SystemStats2"; $outpath = "/var/SystemStats2"; opendir(DH, $inpath); while($file = readdir(DH)) { next if (! -d "$inpath/$file"); opendir(DY, "$inpath/$file/"); while($dfile = readdir(DY)) { $fullpath = "$inpath/$file/$dfile"; next if(! -f $fullpath); $fulloutpath = "$outpath/$file/$dfile"; ($rrdfile) = $fulloutpath =~ /(.*)\.xml/; $cmd = "rrdtool restore $fullpath $rrdfile"; mkdir("$outpath/$file"); $result = system($cmd); print "$dfile: $result\n"; } closedir(DY); } closedir(DH);