Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone
I'm developing a job with a java component to get total numbers of files in a specific path.
Lines of code are:
File
carpeta
=
new
File
(
"E:\\Documentación"
);
File[] lista = carpeta.listFiles();
int
cuenta=
0
;
for
(
int
i
=
0
; i < lista.length; i++)
if
(lista[i].isFile())
cuenta++;
System.out.println(
"\n Hay "
+ cuenta +
" archivos"
);
The job is
In the code i change to read according tFileList_1 configuration
Regards.
Hi
You don't need to hard code on tJava to get the counts of files are found in the specific path. Just use tFileList to get the file list and use the global variable.
tFileList
|onsubjob
tJava
on tJava:
int file_counts=((Integer)globalMap.get("tFileList_1_NB_FILE"));
System.out.println(file_counts);
Regards
Shong
Thanks for your help
The code line is exactly I need it
If I need to use for other path (aws) it's possible to modify that code line???
Regards.
@Emmanuel Trejo
Sorry, I don't understand your question well, other path(aws)? which code line?
Regards
Shong
It does not matter what the location is (local or AWS etc.), as long as you are using the tFileList you can use the Global Variables. The easiest way to do it, is to go to the Outline (bottom left in the Studio) and drag the required variable into your tJava component. In this case you would need the "Number of files - NB_FILE (Flow)".