📄 fileoperate.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -