Created
August 16, 2012 17:28
-
-
Save anderson-martins/3371883 to your computer and use it in GitHub Desktop.
Lista arquivos, pastas e subpastas de um diretorio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static java.util.List<FileItem> listDirectoryAppend(File dir, java.util.List<FileItem> lista) { | |
if (dir.isDirectory()) { | |
String[] filhos = dir.list(); | |
for (int i = 0; i < filhos.length; i++) { | |
File nome = new File(dir, filhos[i]); | |
if (nome.isFile()) { | |
if (nome.getName().toUpperCase().endsWith(".GBK")) { | |
lista.add(new FileItem(nome)); | |
} | |
} else if (nome.isDirectory()) { | |
listDirectoryAppend(nome, lista); | |
} | |
} | |
} else { | |
lista.add(new FileItem(dir)); | |
} | |
return lista; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
esta bacana, mas esse java.util.List lista importe deveria ser omitido.