/**
* 获取文件夹下的所有文件
*
* @param path
* @return
*/
public static File[] listFile(String path)
{
File f = null;
// 新建文件实例
f = new File(path);
// 此处获取文件夹下的所有文件
File[] list = f.listFiles();
return list;
}
/**
* 剪切文件到另一个文件夹
*
* @param frompath 剪切文件名(全路径)
* @param topath 目标文件夹
* @param topathname 目标文件名 (全路径)
*/
public static void move(String frompath,String topath,String topathname)
{
// 如果目标文件夹不存在,创建新的日期文件夹
if (!(new File(topath).exists())) {
new File(topath).mkdir();
}
File from = new File(frompath);
File to = new File(topathname);
from.renameTo(to);
}
/**
* @param args
*/
public static void main(String[] args)
{
File[] list=listFile("D:\\cert");
for (int i = 0; i < list.length; i++)
{
System.out.println(list[i].getAbsolutePath());
}
}