Hi guys I have written a code which will output the contents from a xml files located in different folders into a csv file. But when there are no xml files, I would like to return a print statement with "No files" found.
The issue is my code just refuses to go into the main if statement and always executes the else statement.
Below is my code.
public class XMLReadExtract {
public void extract_XML_Data(String InputPath, File OutputPath, FileWriter fileWriter) throws Exception {
String COMMA_DELIMITER = ","; /* Delimiter used for csv */
File root = new File(InputPath);
File[] list = root.listFiles(); /* To List all files in the Input Path */
try{
if (list == null){
System.out.println("No files to be read");
return;
} // End of main If Statement