diff --git a/build/generate_filecheck_xml.php b/build/generate_filecheck_xml.php
index 665bb3a65d18ad8038596f50990febe04845cf19..1bc0e2b662013ed950f67e202d5c48cba51813e1 100644
--- a/build/generate_filecheck_xml.php
+++ b/build/generate_filecheck_xml.php
@@ -32,11 +32,33 @@ if (substr($sapi_type, 0, 3) == 'cgi') {
     exit;
 }
 
+require_once($path."../htdocs/master.inc.php");
+require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
 
-// Main
+
+/*
+ * Main
+ */
+
+if (empty($argv[1])) 
+{
+    print "Usage: ".$script_file." release=x.y.z\n";
+    exit -1;
+}
 parse_str($argv[1]);
+
+if ($release != DOL_VERSION)
+{
+    print 'Error: release is not version declared into filefunc.in.php.'."\n";
+    exit -1;
+}
+
 //$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml';
-$outputfile=dirname(__FILE__).'/../htdocs/install/filelist.xml';
+$outputdir=dirname(__FILE__).'/../htdocs/install';
+print 'Delete current files '.$outputdir.'/filelist*.xml'."\n";
+dol_delete_file($outputdir.'/filelist*.xml',0,1,1);
+
+$outputfile=$outputdir.'/filelist-'.$release.'.xml';
 $fp = fopen($outputfile,'w');
 fputs($fp, '<?xml version="1.0" encoding="UTF-8" ?>'."\n");
 fputs($fp, '<checksum_list version="'.$release.'">'."\n");
diff --git a/htdocs/install/.gitignore b/htdocs/install/.gitignore
index 7e55df64ce765d5d29bae53725fd6995e43b82f6..85797d21c9505234747e009d4b29501fe0eba6b6 100644
--- a/htdocs/install/.gitignore
+++ b/htdocs/install/.gitignore
@@ -1 +1 @@
-/filelist.xml
+/filelist*.xml