Here you can find the source of getFileListDeep(File path)
public static Set<String> getFileListDeep(File path)
//package com.java2s; /*//from www. j ava 2s . c o m * Tigase Jabber/XMPP Server * Copyright (C) 2004-2012 "Artur Hefczyc" <artur.hefczyc@tigase.org> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, version 3 of the License. * * This program 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. Look for COPYING file in the top folder. * If not, see http://www.gnu.org/licenses/. * * $Rev$ * Last modified by $Author$ * $Date$ */ import java.io.File; import java.util.*; public class Main { public static Set<String> getFileListDeep(File path) { Set<String> set = new TreeSet<String>(); if (path.isDirectory()) { String[] files = path.list(); for (String file : files) { walkInDirForFiles(path, file, set); } // end of for () } else { set.add(path.toString()); } // end of if (file.isDirectory()) else return set; } public static void walkInDirForFiles(File base_dir, String path, Set<String> set) { File tmp_file = new File(base_dir, path); if (tmp_file.isDirectory()) { String[] files = tmp_file.list(); for (String file : files) { walkInDirForFiles(base_dir, new File(path, file).toString(), set); } // end of for () } else { if (path.toString().contains("Plugin")) { System.out.println("File: " + path.toString()); } set.add(path); } // end of if (file.isDirectory()) else } }