Java file operations Daquan 2: directory establishment of checks and delete
Abstract: Java file operations Daquan 2: Contents of the establishment of checks and delete
</ Td> </ tr> <tr> <td height="35" valign="top" class="ArticleTeitle"> <table width="729" border="0"> <tr> <td width = " 723 "> </ td> </ tr> </ table>
<% @ Page contentType = "text / html; gb2312 charset ="%>
<% @ Page import = "java.io. *"%>
<head>
</ Head>
<body>
<%
String path = request.getRealPath ( "/ article/article5a/example/filetest");
Path = path + "\ \ Sub" / / will be established by the directory path
File d = new File (path); / / Sub directory that represents the File object, and a quote to get it
If (Sub d.exists ()){// check whether there directory
D.delete ();
Out.println ( "Sub directory exists, has been deleted");
Else ()
D.mkdir ();// establish Sub directory
Out.println ( "Sub directory does not exist, has been established");
)
%>
</ Body>
</ Td> </ tr> <tr>
↑ Back
Tags: File






