I have files on server in following directory:
D:\tomcat8\webapps\schema_files\
I want to list all files present in above directory.
What I have tried
<%
String folder=application.getRealPath("D:/tomcat8/webapps/schema_files");
File file=new File(folder);
String fileNames[]=file.list();
System.out.println("fileNames[] : "+fileNames[0]);
%>
Its not working.
However if I store files in application itself at "/WEB-INF/filefolder" then following code works.
<%
String folder=application.getRealPath("/WEB-INF/filefolder");
File file=new File(folder);
String fileNames[]=file.list();
System.out.println("fileNames[] : "+fileNames[0]);
%>
Please help me..