fileoperate.java
来自「ftp管理。构造网络路径部分比较好。内部有数据库截图。。」· Java 代码 · 共 51 行
JAVA
51 行
package common;
import java.io.File;
public class FileOperate {
public FileOperate() {
}
/**
* 新建目录
*
* @param folderPath
*
*/
public void createFolder(String folderPath) {
try {
java.io.File myFilePath = new java.io.File(folderPath);
if (!myFilePath.exists()) {
myFilePath.mkdir();
}
} catch (Exception e) {
}
}
/**
* 检查目录是否存在
*
* @param folderPath
*
*/
public boolean checkFolder(String folderPath) {
File myFilePath = new File(folderPath);
if (!myFilePath.exists()) {
return true;
} else {
return false;
}
}
/**
* 重命名目录
*
* @param oldPath
* @param newPath
*/
public void renameFolder(String oldPath, String newPath) {
File f = new File(oldPath);
f.renameTo(new File(newPath));
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?