⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 folder.java

📁 这是基于jsp的相册管理系统。数据库是mysql
💻 JAVA
字号:
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();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -