Index: TXM/trunk/org.txm.utils/src/org/txm/utils/io/IOUtils.java
===================================================================
--- TXM/trunk/org.txm.utils/src/org/txm/utils/io/IOUtils.java	(revision 3376)
+++ TXM/trunk/org.txm.utils/src/org/txm/utils/io/IOUtils.java	(revision 3377)
@@ -24,6 +24,7 @@
 import java.util.regex.Pattern;
 
 import org.eclipse.osgi.util.NLS;
+import org.txm.utils.FileUtils;
 import org.txm.utils.i18n.DetectBOM;
 import org.txm.utils.logger.Log;
 
@@ -47,28 +48,11 @@
 	}
 
 	/**
-	 * select only files not hidden
+	 * select only files not hidden @deprecated
 	 */
-	public static final FileFilter HIDDENFILE_FILTER = new FileFilter() {
-		@Override
-		public boolean accept(File file) {
-			return !file.isHidden() && !file.getName().startsWith(".") && !file.getName().endsWith("~");
-		}
-	};
+	public static final FileFilter HIDDENFILE_FILTER = FileUtils.HIDDENFILE_FILTER;
 
-	/**
-	 * 
-	 * @return a list containing the files not hidden
-	 */
-	public List<File> listFiles(File dir) {
-		
-		File[] files = dir.listFiles(HIDDENFILE_FILTER);
-		if (files == null)
-			return new ArrayList<File>();
 
-		return Arrays.asList(files);
-	}
-
 	public static ArrayList<String> findWithGroup(File file, String encoding, String pattern, boolean normalizeSeparators) throws IOException {
 		
 		ArrayList<String> matches = new ArrayList<String>();
Index: TXM/trunk/org.txm.utils/src/org/txm/utils/FileUtils.java
===================================================================
--- TXM/trunk/org.txm.utils/src/org/txm/utils/FileUtils.java	(revision 3376)
+++ TXM/trunk/org.txm.utils/src/org/txm/utils/FileUtils.java	(revision 3377)
@@ -1,6 +1,12 @@
 package org.txm.utils;
 
 import java.io.File;
+import java.io.FileFilter;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.regex.Pattern;
 
 import org.apache.commons.io.FilenameUtils;
 
@@ -37,7 +43,93 @@
 	public static String stripExtension(File f) {
 		return FilenameUtils.getBaseName(f.getName());
 	}
+	
+	/**
+	 * select file and directories
+	 * ignore hidden files
+	 * 
+	 * @param file a directory or a file (its parent directory will be used)
+	 * @return list of files, null if the file does not exists
+	 */
+	public File[] listFiles(File file) {
+		return listFiles(file, null, false, true);
+	}
+	
+	/**
+	 * select only files not hidden
+	 */
+	public static final FileFilter HIDDENFILE_FILTER = new FileFilter() {
+		@Override
+		public boolean accept(File file) {
+			return !file.isHidden() && !file.getName().startsWith(".") && !file.getName().endsWith("~");
+		}
+	};
 
+	/**
+	 * 
+	 * @return a list containing the files not hidden
+	 */
+	public List<File> listFilesAsList(File dir) {
+		
+		File[] files = dir.listFiles(HIDDENFILE_FILTER);
+		if (files == null)
+			return new ArrayList<File>();
+
+		return Arrays.asList(files);
+	}
+	
+	/**
+	 * 
+	 * @param file a directory or a file (its parent directory will be used)
+	 * @param namePattern null or filename regex 
+	 * @return list of files, null if the file does not exists
+	 */
+	public File[] listFiles(File file, String namePattern, boolean fileOnly, boolean ignoreHiddenFiles) {
+		
+		if (!file.isDirectory()) {
+			file = file.getParentFile();
+		}
+		if (file == null) {
+			return null;
+		}
+		
+		File[] files = file.listFiles(new PatternFilter(namePattern, fileOnly, ignoreHiddenFiles));
+		
+		if (files != null) {
+			Arrays.sort(files); // always sort files by name
+		}
+		
+		return files;
+	}
+	
+	public static class PatternFilter implements FileFilter {
+
+		public Pattern mNamePattern = null;
+		boolean fileOnly;
+		boolean ignoreHiddenFiles;
+		
+		public PatternFilter(String pattern, boolean fileOnly, boolean ignoreHiddenFiles) {
+			if (pattern != null && pattern.length() > 0) {
+				mNamePattern = Pattern.compile(pattern);
+			}
+			this.ignoreHiddenFiles = ignoreHiddenFiles;
+			this.fileOnly = fileOnly;
+		}
+		
+		@Override
+		public boolean accept(File file) {
+			
+			if (fileOnly && !file.isFile()) return false;
+			
+			if (ignoreHiddenFiles && !HIDDENFILE_FILTER.accept(file)) return false;
+			
+			if (mNamePattern == null) return true; // no more tests
+			
+			return mNamePattern.matcher(file.getName()).matches(); // test the whole filename
+		}
+		
+	}
+
 	public static void main(String[] args) {
 		File f = new File("test.gz.Txt");
 		System.out.println("base=" + stripExtension(f));
