#!c:\Perl\bin\perl.exe
my $rep="$ARGV[0]";
# on s'assure que le nom du répertoire ne se termine pas par un "/"
$rep=~ s/[\/]$//;
# on initialise une variable contenant le flux de sortie
my $DUMPFULL1="";
#----------------------------------------
my $output1="SORTIE.xml";
if (!open (FILEOUT,">$output1")) { die "Pb a l'ouverture du fichier $output1"};
#----------------------------------------
my $i=1;
&parcoursarborescencefichiers($rep); #recurse!
#----------------------------------------
print FILEOUT "\n";
print FILEOUT "\n";
print FILEOUT "".$DUMPFULL1."\n";
print FILEOUT "\n";
close(FILEOUT);
exit;
#----------------------------------------------
sub parcoursarborescencefichiers {
my $path = shift(@_);
opendir(DIR, $path) or die "can't open $path: $!\n";
my @files = readdir(DIR);
closedir(DIR);
foreach my $file (@files) {
next if $file =~ /^\.\.?$/;
$file = $path."/".$file;
if (-d $file) {
&parcoursarborescencefichiers($file); #recurse!
}
if (-f $file) {
if ($file=~/0,.*\.xml$/) {
open(FILEINPUT,"$file");
$DUMPFULL1.=" $file\n";
while ($ligne = ) {
if ($ligne=~/([^<]+)<\/title>/) {
$texte=$1;
$texte=~s/'/\'/g;
$texte=~s/é/é/g;
$texte=~s/"/\"/g;
$texte=~s/&/\'/g;
$texte=~s/"/\'/g;
$texte=~s/ê/ê/g;
$DUMPFULL1.=" $1 \n";
}
if ($ligne=~/([^<]+)<\/description>/) {
$texte=$1;
$texte=~s/'/\'/g;
$texte=~s/é/é/g;
$texte=~s/"/\"/g;
$texte=~s/&/\'/g;
$texte=~s/"/\'/g;
$texte=~s/ê/ê/g;
$DUMPFULL1.=" $1 \n";
}
}
$DUMPFULL1.="";
close(FILEINPUT);
}
print $i++,"\n";
}
}
}
#----------------------------------------------