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