Switch to full style
What's behind JSP & Servlets
Post a reply

java code for listing folder contents from remote folder

Tue Apr 17, 2012 8:17 am

Hello,


Can anyone help me with the java code for listing the names of files inside a folder where the folder is stored on the remote server.
I need to display the names and the user should be able to download it too...

Please reply at the earliest.Its really urgent...

Thanks in advance...



Re: java code for listing folder contents from remote folder

Fri Apr 20, 2012 11:46 pm

I didn't try that idea , but for getting files names within a folder :
Code:

 String files
;
  
File myFolder= new File(path);
  
File[] listOfFiles myFolder.listFiles(); 
 
  for (
int i 0listOfFiles.lengthi++) 
  {
 
   if (
listOfFiles[i].isFile()) 
   {
   
files listOfFiles[i].getName();
   
System.out.println(files);
      }
  }
 


Is it possible for you to have a client application and server application, thus use socket programming to pass parameters and response with files names ?

Post a reply
  Related Posts  to : java code for listing folder contents from remote folder
 Zipping a Folder in java     -  
 Listing the Contents of a Directory     -  
 Get all files in folder     -  
 create folder in asp.net     -  
 copy folder     -  
 check folder content using asp     -  
 get Folder path and size     -  
 check existence of file or folder in asp     -  
 print all files names in folder     -  
 Adding watermark to all images in a folder     -