Index: TXM/trunk/org.txm.core/src/java/org/txm/scripts/importer/XMLText2TXTCSV.groovy
===================================================================
--- TXM/trunk/org.txm.core/src/java/org/txm/scripts/importer/XMLText2TXTCSV.groovy	(revision 3402)
+++ TXM/trunk/org.txm.core/src/java/org/txm/scripts/importer/XMLText2TXTCSV.groovy	(revision 3403)
@@ -8,7 +8,7 @@
 println "1) xml -> txt + write metadata.csv"
 outdir.deleteDir()
 outdir.mkdir()
-File metadatafile = Metadatas.findMetadataFile(outdir)
+File metadatafile = new File(outdir, "metadata.csv")
 String csvString = ""
 
 def files = dir.listFiles(IOUtils.HIDDENFILE_FILTER)
Index: TXM/trunk/org.txm.core/src/java/org/txm/metadatas/Metadatas.java
===================================================================
--- TXM/trunk/org.txm.core/src/java/org/txm/metadatas/Metadatas.java	(revision 3402)
+++ TXM/trunk/org.txm.core/src/java/org/txm/metadatas/Metadatas.java	(revision 3403)
@@ -131,7 +131,7 @@
 	 * 
 	 * @param directory
 	 * @return an input file, try in order : ods, xlsx, tsv and finally csv
-	 *         extension
+	 *         extension. If no file is found returns NULL
 	 */
 	public static File findMetadataFile(File directory) {
 		
@@ -144,7 +144,10 @@
 		f = new File(directory, "metadata.tsv");
 		if (f.exists()) return f;
 		
-		return new File(directory, "metadata.csv");
+		f = new File(directory, "metadata.csv");
+		if (f.exists()) return f;
+		
+		return null;
 	}
 	
 	/**
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/importer/XTZImporterMacro.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/importer/XTZImporterMacro.groovy	(revision 3402)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/prototypes/importer/XTZImporterMacro.groovy	(revision 3403)
@@ -233,15 +233,13 @@
 
 println "Trying to read metadata from: "+allMetadataFile
 if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
-if (allMetadataFile.exists()) {
+if (allMetadataFile != null && allMetadataFile.exists()) {
 	File copy = new File(binDir, allMetadataFile.getName())
 	if (!FileCopy.copy(allMetadataFile, copy)) {
 		println "Error: could not create a copy of metadata file "+allMetadataFile.getAbsoluteFile();
 		return;
 	}
 	metadatas = new Metadatas(copy, Toolbox.getMetadataEncoding(), Toolbox.getMetadataColumnSeparator(), Toolbox.getMetadataTextSeparator(), 1)
-} else {
-	println "no metadata file: "+allMetadataFile
 }
 
 if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/PrepareTranscriptionsMacro.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/PrepareTranscriptionsMacro.groovy	(revision 3402)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/projects/nov13/PrepareTranscriptionsMacro.groovy	(revision 3403)
@@ -63,6 +63,9 @@
 sectionsDirectory.mkdir()
 gse.runMacro(org.txm.macro.transcription.SegmentTRSInSectionFromMarkerMacro, ["trsDirectory":trsDirectory, "resultDirectory":sectionsDirectory, "newSectionMarker":newSectionMarker, "debug":debug])
 
+if (cleanWorkingDirectories) {
+	trsDirectory.deleteDir()
+}
 
 println "SPOTTING 'OTHER' TURNS..."
 
@@ -90,6 +93,9 @@
 	}
 }
 cpb.done()
+if (cleanWorkingDirectories) {
+	sectionsDirectory.deleteDir()
+}
 
 println "CONVERTING WORD MARKERS TO EVENTS..."
 
@@ -103,6 +109,9 @@
 eventsDirectory.mkdir()
 gse.runMacro(org.txm.macro.transcription.AddEventsFromWordMarkersMacro, ["trsDirectory":otherDirectory, "resultDirectory":eventsDirectory, "wordElement": "w", "newEventMarker":"XXX", "eventDescription":"termes incompréhensibles ou inaudibles", "eventType":"pi", "eventExtent": "instantaneous", "debug":debug])
 
+if (cleanWorkingDirectories) {
+	otherDirectory.deleteDir()
+}
 
 println "NORMALIZING SPEAKER IDs..."
 
@@ -141,9 +150,6 @@
 cpb.done()
 
 if (cleanWorkingDirectories) {
-	otherDirectory.deleteDir()
-	trsDirectory.deleteDir()
-	sectionsDirectory.deleteDir()
 	eventsDirectory.deleteDir()
 }
 
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/xml/XMLText2MetadataCSVMacro.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/xml/XMLText2MetadataCSVMacro.groovy	(revision 3402)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/macro/xml/XMLText2MetadataCSVMacro.groovy	(revision 3403)
@@ -48,8 +48,9 @@
 }
 println "XPATH queries: $xpaths"
 
-if (metadataFile == null)
-	metadataFile = Metadatas.findMetadataFile(srcDirectory)
+if (metadataFile == null) {
+	metadataFile = new File(srcDirectory, "metadata.csv")
+}
 
 def writer = metadataFile.newWriter("UTF-8")
 println "Creating file: $metadataFile"
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/prototypes/InjectMetadataCSV.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/prototypes/InjectMetadataCSV.groovy	(revision 3402)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/prototypes/InjectMetadataCSV.groovy	(revision 3403)
@@ -1,11 +1,11 @@
 package org.txm.scripts.test;
 import org.txm.metadatas.*;
 
-def txmfilesdir = new File("C:\\Documents and Settings\\alavrent\\xml\\metadata")
-def outdir = new File("C:\\Documents and Settings\\alavrent\\xml\\metadata\\meta")
+def txmfilesdir = new File(System.getProperty("user.home"), "xml/metadata")
+def outdir =  new File(System.getProperty("user.home"), "xml/metadata/meta")
 outdir.mkdir()
-def allMetadataFile = Metadatas.findMetadataFile(new File("C:\\Documents and Settings\\alavrent\\xml\\metadata"));
-println "-- INJECT METADATA - from csv file: "+allMetadataFile+" in directory: "+txmfilesdir
+def allMetadataFile = Metadatas.findMetadataFile(outdir);
+println "-- INJECT METADATA - from table file: "+allMetadataFile+" in directory: "+txmfilesdir
 def metadatas = new Metadatas(allMetadataFile, "UTF-8", ",","\"", 1)
 if(metadatas != null)
 {
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/doc/docLoader.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/doc/docLoader.groovy	(revision 3402)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/doc/docLoader.groovy	(revision 3403)
@@ -192,7 +192,7 @@
 if (MONITOR != null) MONITOR.worked(20, "READ METADATA")
 Metadatas metadatas; // text metadata
 //println "Trying to read metadata from: "+allMetadataFile
-if (allMetadataFile.exists()) {
+if (allMetadataFile != null && allMetadataFile.exists()) {
 	File copy = new File(binDir, allMetadataFile.getName())
 	if (!FileCopy.copy(allMetadataFile, copy)) {
 		println "Error: could not create a copy of the $allMetadataFile file "+allMetadataFile.getAbsoluteFile();
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/factiva/factivaLoader.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/factiva/factivaLoader.groovy	(revision 3402)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/factiva/factivaLoader.groovy	(revision 3403)
@@ -161,7 +161,7 @@
 //get metadata values from CSV
 Metadatas metadatas; // text metadata
 println "Trying to read metadata from: "+allMetadataFile
-if (allMetadataFile.exists()) {
+if (allMetadataFile != null && allMetadataFile.exists()) {
 	File copy = new File(binDir, allMetadataFile.getName())
 	if (!FileCopy.copy(allMetadataFile, copy)) {
 		println "Error: could not create a copy of metadata file "+allMetadataFile.getAbsoluteFile();
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/transcriberLoader.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/transcriberLoader.groovy	(revision 3402)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/transcriber/transcriberLoader.groovy	(revision 3403)
@@ -102,8 +102,9 @@
 //get metadata values from CSV
 Metadatas metadatas; // text metadata
 File allMetadataFile = Metadatas.findMetadataFile(srcDir);
-println "Reading metadata values from: "+allMetadataFile
-if (allMetadataFile.exists()) {
+
+if (allMetadataFile != null && allMetadataFile.exists()) {
+	println "Reading metadata values from: "+allMetadataFile
 	File copy = new File(binDir, allMetadataFile.getName())
 	if (!FileCopy.copy(allMetadataFile, copy)) {
 		println "Error: could not create a copy of metadata file "+allMetadataFile.getAbsoluteFile();
@@ -112,9 +113,6 @@
 	metadatas = new Metadatas(copy, Toolbox.getMetadataEncoding(),
 			Toolbox.getMetadataColumnSeparator(),
 			Toolbox.getMetadataTextSeparator(), 1)
-}
-else {
-	println "no metadata file: "+allMetadataFile
 }
 
 final HashMap<String, String> textordersInfo = new HashMap<String, String>();
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/txt/txtLoader.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/txt/txtLoader.groovy	(revision 3402)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/txt/txtLoader.groovy	(revision 3403)
@@ -80,7 +80,7 @@
 Metadatas metadatas; // text metadata
 File allMetadataFile = Metadatas.findMetadataFile(srcDir);
 
-if (allMetadataFile.exists()) {
+if (allMetadataFile != null && allMetadataFile.exists()) {
 	println "Trying to read metadata from: "+allMetadataFile
 	File copy = new File(binDir, allMetadataFile.getName())
 	if (!FileCopy.copy(allMetadataFile, copy)) {
@@ -90,8 +90,6 @@
 	metadatas = new Metadatas(copy, Toolbox.getMetadataEncoding(), 
 		Toolbox.getMetadataColumnSeparator(), 
 		Toolbox.getMetadataTextSeparator(), 1)
-} else {
-	println "No metadata file: "+allMetadataFile
 }
 
 def suffixes = ["txt", "TXT"]
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImporter.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImporter.groovy	(revision 3402)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImporter.groovy	(revision 3403)
@@ -111,8 +111,7 @@
 		
 		//prepare metadata if any
 		File allMetadataFile = Metadatas.findMetadataFile(inputDirectory);
-		println "ALLMETADATAFILE="+allMetadataFile
-		if (allMetadataFile.exists()) {
+		if (allMetadataFile != null && allMetadataFile.exists()) {
 			File copy = new File(binDir, allMetadataFile.getName())
 			if (!FileCopy.copy(allMetadataFile, copy)) {
 				println "Error: could not create a copy of the metadata file "+allMetadataFile.getAbsoluteFile();
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImport.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImport.groovy	(revision 3402)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZImport.groovy	(revision 3403)
@@ -46,7 +46,7 @@
 		Metadatas metadata = importer.getMetadata();
 		if (metadata == null) { // if metadata was not built, try building it
 			File allMetadataFile = Metadatas.findMetadataFile(binaryDirectory);
-			if (allMetadataFile.exists()) {
+			if (allMetadataFile != null && allMetadataFile.exists()) {
 				metadata = new Metadatas(allMetadataFile,
 						Toolbox.getPreference(TBXPreferences.METADATA_ENCODING),
 						Toolbox.getPreference(TBXPreferences.METADATA_COLSEPARATOR),
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xmltxm/xmltxmLoader.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xmltxm/xmltxmLoader.groovy	(revision 3402)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xmltxm/xmltxmLoader.groovy	(revision 3403)
@@ -84,8 +84,6 @@
 txmDir.deleteDir();
 txmDir.mkdirs();
 
-File allMetadataFile = Metadatas.findMetadataFile(srcDir);
-
 // Apply XSL
 if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
 if (MONITOR != null) MONITOR.worked(1, "APPLYING XSL")
@@ -115,42 +113,6 @@
 	return;
 }
 
-////get metadata values from CSV
-//Metadatas metadatas; // text metadata
-//if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
-//if (allMetadataFile.exists()) {
-//	println "Trying to read metadata from: "+allMetadataFile
-//	File copy = new File(binDir, "metadata.csv")
-//	if (!FileCopy.copy(allMetadataFile, copy)) {
-//		println "Error: could not create a copy of metadata file "+allMetadataFile.getAbsoluteFile();
-//		return;
-//	}
-//	metadatas = new Metadatas(copy, Toolbox.getMetadataEncoding(), Toolbox.getMetadataColumnSeparator(), Toolbox.getMetadataTextSeparator(), 1)
-//} else {
-//	println "no metadata file: "+allMetadataFile
-//}
-//
-//if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
-//if (MONITOR != null) MONITOR.worked(20, "INJECTING METADATA - from csv file: "+allMetadataFile)
-//if (metadatas != null) {
-//	println("Injecting metadata: "+metadatas.getHeadersList()+" in texts of directory "+txmDir)
-//	for (File infile : files) {
-//		print "."
-//		File outfile = File.createTempFile("temp", ".xml", infile.getParentFile());
-//
-//		if (!metadatas.injectMetadatasInXml(infile, outfile, "text", null)) {
-//			outfile.delete();
-//		} else {
-//			if (!(infile.delete() && outfile.renameTo(infile))) println "Warning can't rename file "+outfile+" to "+infile
-//			if (!infile.exists()) {
-//				println "Error: could not replace $infile by $outfile"
-//				return false;
-//			}
-//		}
-//	}
-//	println ""
-//}
-
 //sorting files per metadata "date" with format
 def dates = [:]
 def useDates = false
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/discours/importer.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/discours/importer.groovy	(revision 3402)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/discours/importer.groovy	(revision 3403)
@@ -2,19 +2,19 @@
 // Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
 // Lyon 2, University of Franche-Comté, University of Nice
 // Sophia Antipolis, University of Paris 3.
-// 
+//
 // The TXM platform is free software: you can redistribute it
 // and/or modify it under the terms of the GNU General Public
 // License as published by the Free Software Foundation,
 // either version 2 of the License, or (at your option) any
 // later version.
-// 
+//
 // The TXM platform is distributed in the hope that it will be
 // useful, but WITHOUT ANY WARRANTY; without even the implied
 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 // PURPOSE. See the GNU General Public License for more
 // details.
-// 
+//
 // You should have received a copy of the GNU General
 // Public License along with the TXM platform. If not, see
 // http://www.gnu.org/licenses.
@@ -56,12 +56,11 @@
 import org.txm.utils.io.*;
 import org.txm.utils.i18n.DetectBOM;
 
-// TODO: Auto-generated Javadoc
 /**
  * The Class importer.
  */
 class importer {
-
+	
 	/**
 	 * Run.
 	 *
@@ -70,15 +69,15 @@
 	 * @param basename the basename
 	 * @return true, if successful
 	 */
-	public boolean run(File srcDir, File binDir, File txmDir, String encoding, String basename, def project)
-	{
+	public boolean run(File srcDir, File binDir, File txmDir, String encoding, String basename, def project) {
+		
 		String rootDir = srcDir.getAbsolutePath()+"/"
 		// scanning directory brut/*.cnr
 		String extension = "cnr";
 		File[] list = srcDir.listFiles();
 		
 		if (list == null || list.length == 0) return false;
-
+		
 		LinkedList filelist = new LinkedList();
 		for (File cnr : list) {
 			if (cnr.getName().endsWith("."+extension)) {
@@ -86,21 +85,21 @@
 			}
 		}
 		Collections.sort(filelist);
-
+		
 		// get the headers
 		def csvfile = Metadatas.findMetadataFile(srcDir);
 		Metadatas metadatas; // text metadata
 		
 		println "Trying to read metadata from: "+csvfile
-		if (csvfile.exists()) {
+		if (csvfile != null && csvfile.exists()) {
 			File copy = new File(binDir, csvfile.getName())
 			if (!FileCopy.copy(csvfile, copy)) {
 				println "Error: could not create a copy of metadata file "+csvfile.getAbsoluteFile();
 				return;
 			}
-			metadatas = new Metadatas(copy, Toolbox.getMetadataEncoding(), 
-		Toolbox.getMetadataColumnSeparator(), 
-		Toolbox.getMetadataTextSeparator(), 1)
+			metadatas = new Metadatas(copy, Toolbox.getMetadataEncoding(),
+					Toolbox.getMetadataColumnSeparator(),
+					Toolbox.getMetadataTextSeparator(), 1)
 		} else {
 			println "No metadata file: "+csvfile
 			println "Aborting"
@@ -111,17 +110,17 @@
 		def attrs = ["para", "sent", "form", "lem", "pos", "func"];
 		int formid = 2;
 		String separator = "\t";
-
+		
 		String encodingAll = null;
 		if (encoding == "??") {
 			encodingAll = new CharsetDetector(srcDir).getEncoding();
 			println "Guessed encoding: $encodingAll"
 		}
-
+		
 		print "Converting CNR to XML:"
 		def second = 0
-		for (String id : metadatas.keySet()) // loop on text nodes
-		{
+		for (String id : metadatas.keySet()) { // loop on text nodes
+		
 			int sentence=-1, paragraph=-1, idword=0;
 			String lastopenlocalname= "", localname = "";
 			int para = -1, sent = -1;
@@ -129,21 +128,21 @@
 			// = textnode.attribute("id")
 			ArrayList<org.txm.metadatas.Entry> metas = metadatas.get(id);
 			
-			String filename = id +".cnr";
-			File srcfile = new File(srcDir, filename);
+			String filename = id +".cnr"
+			File srcfile = new File(srcDir, filename)
 			if (!srcfile.exists()) {
 				println "Can't find CNR file : "+filename
 				continue
 			}
-			File teifile = new File(txmDir, id+".xml");
+			File teifile = new File(txmDir, id+".xml")
 			//println("||"+srcfile+">>"+teifile.getAbsolutePath());
-			OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(teifile), "UTF-8");
-
-//			if (second) { print(", ") }
-//			if ((second % 5) == 0) println ""
-//			print(filename.replaceFirst("\\.cnr", ""));
-//			second++
-
+			OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(teifile), "UTF-8")
+			
+			//			if (second) { print(", ") }
+			//			if ((second % 5) == 0) println ""
+			//			print(filename.replaceFirst("\\.cnr", ""));
+			//			second++
+			
 			// HEADER
 			writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
 			writer.write("<TEI xmlns=\"http://www.tei-c.org/ns/1.0\" xmlns:txm=\"http://textometrie.org/1.0\">\n");
@@ -169,25 +168,25 @@
 				String name = metadata.getId()
 				String value = metadata.getValue()
 				if (name != "id")
-					writer.write(" "+name+"=\""+value.replace("&", "&amp;").replace("<", "&lt;").replace("\"", "&quot;")+"\"");	
+					writer.write(" "+name+"=\""+value.replace("&", "&amp;").replace("<", "&lt;").replace("\"", "&quot;")+"\"");
 			}
 			writer.write(" id=\""+id.replace("&", "&amp;").replace("<", "&lt;").replace("\"", "&quot;")+"\"");
 			writer.write(">\n");
-
+			
 			//def content = srcfile.getText(encoding)
 			String tmpEncoding = encoding;
 			if (encodingAll != null) {
 				tmpEncoding = encodingAll
 				if (srcfile.length() > CharsetDetector.MINIMALSIZE) {
-					tmpEncoding = new CharsetDetector(srcfile).getEncoding();
-					//println "file encoding: $tmpEncoding"	
+					tmpEncoding = new CharsetDetector(srcfile).getEncoding()
+					//println "file encoding: $tmpEncoding"
 				}
 			}
 			def input = new FileInputStream(srcfile)
-			def reader = new BufferedReader(new InputStreamReader(input , tmpEncoding));
+			def reader = new BufferedReader(new InputStreamReader(input , tmpEncoding))
 			DetectBOM bomdetector = new DetectBOM(srcfile);
 			for (int ibom = 0 ; ibom < bomdetector.getBOMSize() ; ibom++) input.read()
-
+			
 			// BODY
 			String line = reader.readLine();
 			int nline = 0;
@@ -198,6 +197,7 @@
 				nline++;
 				String[] fields = line.split(separator);
 				if (fields.size() == attrs.size()) {
+					
 					idword++;
 					
 					String paraV = fields[0].replaceAll("\\p{C}", "")
@@ -247,7 +247,7 @@
 				}
 				line = reader.readLine();
 			}
-
+			
 			// CLOSE
 			if(sentence != -1) { writer.write("</s>\n") }
 			if(paragraph != -1) { writer.write("</p>\n") }
@@ -264,6 +264,7 @@
 		println ""
 		
 		if (project.getCleanAfterBuild()) {
+			
 			new File(project.getProjectDirectory(), "tokenized").deleteDir()
 			new File(project.getProjectDirectory(), "ptokenized").deleteDir()
 			new File(project.getProjectDirectory(), "stokenized").deleteDir()
@@ -272,24 +273,24 @@
 		}
 		return true;
 	}
-
+	
 	/**
 	 * Gets the metadata.
 	 *
 	 * @return the metadata
 	 */
-	public List<String> getMetadatas()
-	{
-		return metaDatas;
+	public List<String> getMetadatas() {
+		
+		return metadatas;
 	}
-
+	
 	/**
 	 * The main method.
 	 *
 	 * @param args the arguments
 	 */
-	public static void main(String[] args)
-	{
+	public static void main(String[] args) {
+		
 		File dir = new File(System.getProperty("user.home"), "xml/discours/");
 		new importer().run(dir);
 	}
Index: TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xml/xmlLoader.groovy
===================================================================
--- TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xml/xmlLoader.groovy	(revision 3402)
+++ TXM/trunk/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xml/xmlLoader.groovy	(revision 3403)
@@ -177,7 +177,7 @@
 
 println "Trying to read metadata from: "+allMetadataFile
 if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done() }
-if (allMetadataFile.exists()) {
+if (allMetadataFile != null && allMetadataFile.exists()) {
 	println " Metadata file found: "+allMetadataFile
 	File copy = new File(binDir, allMetadataFile.getName())
 	if (!FileCopy.copy(allMetadataFile, copy)) {
@@ -185,8 +185,6 @@
 		return
 	}
 	metadatas = new Metadatas(copy, Toolbox.getMetadataEncoding(), Toolbox.getMetadataColumnSeparator(), Toolbox.getMetadataTextSeparator(), 1)
-} else {
-	println " No metadata file: "+allMetadataFile
 }
 
 if (MONITOR != null && MONITOR.isCanceled()) { return MONITOR.done(); }
Index: TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/MetadataPage.java
===================================================================
--- TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/MetadataPage.java	(revision 3402)
+++ TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/MetadataPage.java	(revision 3403)
@@ -480,9 +480,9 @@
 		//viewer2.refresh();
 		if (main.getRootDir() == null) return;
 		
-		metadataFile = Metadatas.findMetadataFile(new File(main.getRootDir())); //$NON-NLS-1$
+		metadataFile = Metadatas.findMetadataFile(new File(main.getRootDir()));
 		Metadatas temp = null;
-		if (metadataFile.exists()) {//if their is a metadata file OK
+		if (metadataFile != null && metadataFile.exists()) {//if their is a metadata file OK
 				String encoding = TBXPreferences.getInstance().getString(TBXPreferences.METADATA_ENCODING);
 				String colsep = TBXPreferences.getInstance().getString(TBXPreferences.METADATA_COLSEPARATOR);
 				String txtsep = TBXPreferences.getInstance().getString(TBXPreferences.METADATA_TXTSEPARATOR);
Index: TXM/trunk/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/tigersearch/TSImporter.groovy
===================================================================
--- TXM/trunk/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/tigersearch/TSImporter.groovy	(revision 3402)
+++ TXM/trunk/org.txm.tigersearch.rcp/groovy/org/txm/scripts/importer/tigersearch/TSImporter.groovy	(revision 3403)
@@ -31,7 +31,7 @@
 		
 		//prepare metadata if any
 		File allMetadataFile = Metadatas.findMetadataFile(inputDirectory);
-		if (allMetadataFile.exists()) {
+		if (allMetadataFile != null && allMetadataFile.exists()) {
 			File copy = new File(module.getBinaryDirectory(), allMetadataFile.getName())
 			if (!FileCopy.copy(allMetadataFile, copy)) {
 				println "Error: could not create a copy of the metadata file "+allMetadataFile.getAbsoluteFile();
