diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..fb50116 --- /dev/null +++ b/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..fb0816c --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + Tree + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/README.md b/README.md index 5440f6b..f9aa709 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,23 @@ # Tree +## Usage +Hay que pasar la ruta del directorio y la extensión en los argumentos al ejecutarlo. +Buscara los archivos que tengan esa extension en todas las carpetas del directorio. +``` +|PMDM +|_prac_instalació_android_studio.pdf +|_Presentació_programació_multimedia_i_dispositius_mòbils.pdf +|_Presentació_Tutoria.pdf +|_T1 +|__Nueva carpeta +|__prac_autoevaluació.pdf +|__Tema01_Tecnologies_per_al_desenvolupament_daplicacions_mòbils.pdf +|_T2 +|__Tema02_Arquitectura_i_estructura_duna_aplicació_Android.pdf +|_T3 +|__butlleti_exercicis.pdf +|__Tema03_Interfícies_dusuari_Layouts_i_controls_bàsics.pdf +|_T4 +|__exercici_spinner_llista_països.pdf +|__Tema04_Interfícies_dusuari_Controls_de_selecció.pdf +``` \ No newline at end of file diff --git a/bin/es/antoniotgit/TreeComand.class b/bin/es/antoniotgit/TreeComand.class new file mode 100644 index 0000000..7f35225 Binary files /dev/null and b/bin/es/antoniotgit/TreeComand.class differ diff --git a/src/es/antoniotgit/TreeComand.java b/src/es/antoniotgit/TreeComand.java new file mode 100644 index 0000000..e4fbef5 --- /dev/null +++ b/src/es/antoniotgit/TreeComand.java @@ -0,0 +1,31 @@ +package es.antoniotgit; + +import java.io.File; +import java.io.IOException; + +public class TreeComand { + public static void printFile(File f, String spaces, String extension) { + System.out.println(spaces.concat(/*File.separator*/"").concat(f.getName())); + if (f.isDirectory() && f.canRead()) { + for (File file : f.listFiles()) { + if(file.isDirectory() || file.getName().endsWith(extension)) + printFile(file, spaces.concat("_"),extension); + } + } + + } + + public static void main(String[] args) throws IOException{ + if(args.length > 2) { + System.out.println("ERROR solo 2 argumentos"); + System.exit(1); + } + + String path = args[0]; + String extension = args[1]; + + printFile(new File(path), "|", extension); + //"C:\\Users\\Anto.LAPTOP-CR44LNOV\\Desktop\\PMDM" + } + +}