角色分配的java代码 角色权限系统 java( 二 )


import java.util.*;
*/
LinkedList folderList = new LinkedListString();
folderList.add(%%1);
while (folderList.size()0) {
File file = new File(folderList.poll());
File[] files = file.listFiles();
ArrayListFilefileList = new ArrayListFile();
for (int i = 0; ifiles.length; i) {
if (files[i].isDirectory()) {
folderList.add(files[i].getPath());
} else {
fileList.add(files[i]);
}
}
for (File f : fileList) {
f.delete();
}
}
folderList = new LinkedListString();
folderList.add(%%1);
while (folderList.size()0) {
File file = new File(folderList.getLast());
if (file.delete()) {
folderList.removeLast();
} else {
File[] files = file.listFiles();
for (int i = 0; ifiles.length; i) {
folderList.add(files[i].getPath());
}
}
}
5.删除一个文件下夹所有的文件夹
/*
import java.io.*;
private static LinkedListString folderList=null;
*/
File delfile=new File(%%1);
File[] files=delfile.listFiles();
for(int i=0;ifiles.length;i){
if(files[i].isDirectory()){
if(!files[i].delete()){
folderList = new LinkedListString();
folderList.add(files[i]);
while (folderList.size()0) {
File file = new File(folderList.poll());
File[] files = file.listFiles();
ArrayListFilefileList = new ArrayListFile();
for (int i = 0; ifiles.length; i) {
if (files[i].isDirectory()) {
folderList.add(files[i].getPath());
} else {
fileList.add(files[i]);
}
}
for (File f : fileList) {
f.delete();
}
}
folderList = new LinkedListString();
folderList.add(files[i]);
while (folderList.size()0) {
File file = new File(folderList.getLast());
if (file.delete()) {
folderList.removeLast();
} else {
File[] files = file.listFiles();
for (int i = 0; ifiles.length; i) {
folderList.add(files[i].getPath());
}
}
}
}
}
}
6.清空文件夹
//import java.io.*;
File delfilefolder=new File(%%1);
try {
if (!delfilefolder.exists()!delfilefolder.delete()){
LinkedList folderList = new LinkedListString();
folderList.add(delfilefolder);
while (folderList.size()0) {
File file = new File(folderList.poll());
File[] files = file.listFiles();
ArrayListFilefileList = new ArrayListFile();
for (int i = 0; ifiles.length; i) {
if (files[i].isDirectory()) {
folderList.add(files[i].getPath());
} else {
fileList.add(files[i]);
}
}
for (File f : fileList) {
f.delete();
}
}
folderList = new LinkedListString();
folderList.add(delfilefolder);
while (folderList.size()0) {
File file = new File(folderList.getLast());
if (file.delete()) {
folderList.removeLast();
} else {
File[] files = file.listFiles();
for (int i = 0; ifiles.length; i) {
folderList.add(files[i].getPath());
}
}
}
}
delfilefolder.mkdir();
}
catch (Exception e) {
System.out.println("清空目录操作出错");
e.printStackTrace();
}
7.读取文件
//import java.io.
【角色分配的java代码 角色权限系统 java】关于角色分配的java代码和角色权限系统 java的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

推荐阅读