?? folder.java
字號(hào):
package huitong.util;
import java.io.*;
public class Folder
{
private String folderPath = FinalVar.rootPath;
private String path = null;
public Folder()
{}
public Folder(String path)
{
this.path = path;
}
public boolean create(String path)
{
if (path == null) return create();
this.path = path;
return create();
}
public boolean create()
{
File file = null;
file = new File(getPath());
System.out.println(folderPath);
System.out.println("in Folder : path = " + getPath());
if (file.isDirectory())
{
System.out.println(" The folder of the path exists !");
return false;
}
if (file.mkdir())
{
System.out.println(" The folder is created successfully");
return true;
}
System.out.println(" The folder isn't created ");
return false;
}
public boolean del(String path)
{
if (path == null) return create();
this.path = path;
return del();
}
public boolean del()
{
new File(getPath()).delete();
return true;
}
private String getPath()
{
if (path == null)
{
System.out.println(" The param of path is null !");
return null;
}
if (path.startsWith("\\") || path.substring(1).startsWith(":"))
{
return path;
}
else
{
if (folderPath.endsWith("\\"))return folderPath+path;
else return folderPath+"\\"+path;
}
}
public static void main(String[] agrs)
{
new Folder(""+System.currentTimeMillis()).create();
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -