|
|
@ -7,20 +7,20 @@ public class ActListar { |
|
|
|
File archPrincip; |
|
|
|
if(args.length>0) { |
|
|
|
archPrincip = new File(args[0]); |
|
|
|
//pasa a la carpeta de fecto si los args estan bacios. |
|
|
|
}else { |
|
|
|
archPrincip = new File("C:\\Users\\AntonioFrische\\OneDrive - ABACCO Solutions\\Pictures"); |
|
|
|
} |
|
|
|
listDirectorio(archPrincip, ""); |
|
|
|
} |
|
|
|
|
|
|
|
//metodo que representa la capeta elegida y sus subcarpetas si tiene |
|
|
|
public static void listDirectorio(File path, String location) { |
|
|
|
File[] archList = path.listFiles(); |
|
|
|
for(int i = 0; i < archList.length; i++) { |
|
|
|
System.out.println(location + archList[i].getName());//representa el archivo o la carpeta. |
|
|
|
if(archList[i].isDirectory()) { |
|
|
|
System.out.println(location + archList[i].getName()); |
|
|
|
listDirectorio(archList[i],location+" -"); |
|
|
|
}else { |
|
|
|
System.out.println(location + archList[i].getName()); |
|
|
|
listDirectorio(archList[i],location+" -"); //llama a el mismo otravez para representar las subcarpetas. |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|