public static void deleteFileOrPath(String storePath) {
File fileOrPath = new File(PathUtil.getImgBasePath() + storePath);
if(fileOrPath.exists()) {
if(fileOrPath.isDirectory()) {
File files[] = fileOrPath.listFiles();
for(int i = 0; i<files.length;i++) {
files[i].delete();
}
}
fileOrPath.delete();
}
}
// creates a menu entry to remove a file or a directory.
//创建一个菜单项,来删除文件或文件夹
@MenuItem (“Example/Remove Something”)
static function RemoveAFile () {
//removes the file
//删除文件
FileUtil.DeleteFileOrDirectory(“your/path/to/the/folder/or/file”);
}
SSM商铺V1.0,解决毕设痛点;SpringBoot商铺V2.0,满足工作刚需
了解课程