In Java code, I want to connect to a directory in HDFS, learn the number of files in that directory, get their names and want to read them. I can already read the files but I co
You can use the following to check file count in that particular directory
hadoop fs -count /directoryPath/* | print $2 | wc -l
count : counts the number of files, directories, and bytes under the path
print $2 : To print second column from the output
wc -l : To check the line count