From f4c95addb05ce80b0878a57aed78f0ea9b30b3d4 Mon Sep 17 00:00:00 2001 From: antoniotgit <95379860+antoniotgit@users.noreply.github.com> Date: Fri, 30 Sep 2022 18:02:20 +0200 Subject: [PATCH] funciona --- .classpath | 6 ++++++ .project | 17 +++++++++++++++ README.md | 21 +++++++++++++++++++ bin/es/antoniotgit/TreeComand.class | Bin 0 -> 1528 bytes src/es/antoniotgit/TreeComand.java | 31 ++++++++++++++++++++++++++++ 5 files changed, 75 insertions(+) create mode 100644 .classpath create mode 100644 .project create mode 100644 bin/es/antoniotgit/TreeComand.class create mode 100644 src/es/antoniotgit/TreeComand.java 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 0000000000000000000000000000000000000000..7f35225c641aabe9b485185ba9af54601200507c GIT binary patch literal 1528 zcmZ`((M}sj6g^|FS>tSgtT6-#V45be4T&4KA#F&Lw1lLj22z`vLZzZ%nK+x;yOwvU zh}6eE^cUz`rAmEnA4t?nd_X^-pHq5fO^8W|WbNF!cjn%6&b{M*{`>0yz^B+S5fd0u zK~Z|4@40?hcf;apTd8@!DZOnIhQPox`GYJrq*pJlY&}y>DA04;_1y4|Ks=YP2^jPK zwn`z6UJD8I2=td-Pc82>w^VyoZZ(vEUG^Q>sL8gg_eV}6eCh@QW94@Om=ox2wOucK z;OZld|SuCt4vRYM-DpW?~adT|bE6ZQ!z)#pK|nid9;Aq{_rtTM;RAM29L zsAO|4iD3bxFoH1?qbGAjH7#7gI5ly6&yh@X`3Ph;to++ZQ<%h*iL8Lt&B?-hxF}%O zRk$phzTS{pxZTW(zswnIlrJ;gQ*CkZKyiw1pX56*%Jt_uV#|>$jgr zZQan(qJ4BG%shXp>)1q zlC5aqOe}CT-vG+9P3iK=Q0^#lqHmn;)WWW#S|RfWCLVPuzPNH6Nun$;yilpERI-8J z@Ux|?Y}a?1iq9%YasHMqtl%+=sa=;dV&oR{k^U9^V)99>lJbxA^A`D~Pl3Ww_md$qMkev=;lCPIJc2b5l}jQ`7*q7zB)~-i zTc!OS1|qlx7#b4)#_n*{)?M6-C~V?0S~1=l$LEa3G0*rK5{I}B)5N5S5&j^AiTl7I zhP%8BANx~X{#U1Chm6bLI@#MDz{K7}oy>Qh7jd literal 0 HcmV?d00001 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" + } + +}