Java file operations Daquan 5: directory listed in the document

  Abstract: Java file operations Daquan 5: directory listed in the document 

  </ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width="734" border="0"> <tr> <td width = " 728 "> </ td> </ tr> </ table> 
  <% @ Page contentType = "text / html; gb2312 charset ="%> 
  <% @ Page import = "java.io. *"%> 

<head>

  </ Head> 
<body>
<%
  String path = request.getRealPath ( "/ article/article5a/example/filetest"); 
  File d = new File (path); / / set up the current directory in the File object files 
  File list [] = d.listFiles ();// made on behalf of all the files in the directory object array File 
  Out.println ( "" + path + "directory paper: 
");
  For (int i = 0; i    If (list [i]. IsFile ()) ( 
  Out.println (list [i]. GetName () + " 
");
  ) 
  ) 
  Out.println ( " 
  "+ Path +" directory under the directory: 
");
  For (int i = 0; i    If (list [i]. IsDirectory ()) ( 
  Out.println (list [i]. GetName () + " 
");
  ) 
  ) 
%>
  </ Body> 

  </ Td> </ tr> <tr> 

  ↑ Back 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • DotNetKicks
  • DZone
  • Netvouz
  • Propeller

Tags:

Releated Java Articles

Comments

Leave a Reply