过虑文件拷贝文件的java代码
来源:互联网 发布:上海游族网络 编辑:程序博客网 时间:2024/05/16 07:10
/**
* @param args
*/
static String sourcrRoot = "F:\\book\\eclipse插件\\jbosstools\\sourcefile";
static String targetRoot = "F:\\jbosstoolsv2\\project\\base_Final";
public static void main(String[] args) {
// TODO Auto-generated method stub
File target = new File(targetRoot);
String targetLs[] = target.list();
List fooderPathLs = new ArrayList();
FileOperate fo = new FileOperate();
try {
fo.showAllFileFolder(target, "plugins", fooderPathLs);
} catch (Exception e) {
e.printStackTrace();
}
for (int i = 0; i < fooderPathLs.size(); i++) {
// System.out.println(fooderPathLs.get(i));
try {
targetMathSorce((String) fooderPathLs.get(i));
} catch (Exception e) {
e.printStackTrace();
}
}
}
static private String getSourcePath(String path) {
File target = new File(path);
File forderLs[] = target.listFiles();
FileNameFilter ff = new FileNameFilter("src");
File folderLs[] = target.listFiles(ff);
if (folderLs != null && folderLs.length > 0) {
return folderLs[0].getAbsolutePath();
} else {
ff = new FileNameFilter("org");
folderLs = target.listFiles(ff);
if (folderLs != null && folderLs.length > 0) {
return folderLs[0].getAbsolutePath();
}
}
return "-1";
}
static private void targetMathSorce(String targetpath) throws Exception {
File target = new File(targetpath);
File tartetLs[] = target.listFiles();
FileOperate fo = new FileOperate();
File sourcr = new File(sourcrRoot);
for (int i = 0; i < tartetLs.length; i++) {
List filePathList = new ArrayList();
fo.showAllStartWithFileFolder(sourcr, tartetLs[i].getName() + ".source_", filePathList);
if (filePathList.size() == 0) {
System.out.println(tartetLs[i] + "匹配到0条");
} else {
String srcPath = getSourcePath((String) filePathList.get(0));
if ("-1".equals(srcPath)) {
System.out.println(tartetLs[i].getName() + "匹配到" + filePathList.size() + "条 但没有 src or org "
+ (String) filePathList.get(0));
} else {
System.out.println(tartetLs[i].getName() + "匹配到" + filePathList.size() + "条" + srcPath);
File tem = new File((String) filePathList.get(0));
if (srcPath.endsWith("src"))
fo.copyFolder(srcPath, tartetLs[i].getAbsolutePath() + "\\src");
else {
fo.copyFolder(srcPath, tartetLs[i].getAbsolutePath() + "\\src" + "\\org");
}
}
}
}
}
- 过虑文件拷贝文件的java代码
- java拷贝文件代码
- java代码拷贝文件
- java文件的拷贝
- Java 文件的拷贝
- 经典的文件拷贝代码
- Java代码拷贝对应的文件到指定目录
- 多线程下载,拷贝文件java代码
- Java实现拷贝文件详细代码
- Java中 文件拷贝代码模型
- JAVA学习笔记(二十七) - 文件过虑器
- python文件拷贝代码
- C++文件拷贝代码
- 拷贝文件代码
- 拷贝文件经典代码
- 拷贝文件代码
- 最简短的文件拷贝C++代码
- 用python代码实现文件的拷贝
- 用指针判断是否两个数组是否有相同的数字,有的话输出相同数字
- 程序员如何正确的评估自己的薪资
- Android学习之 Java基础
- 第十六周OJ(B)
- HDU 1894 String Compare (排序)
- 过虑文件拷贝文件的java代码
- SQLServer 还原语法
- 第十六周项目3-用函数指针调用函数
- 查找(问题代码)
- 开发:随笔记录之 生成6位随机数
- 端口占用
- 第十六周 项目二--用指针玩字符串(2.1.1数组名作形式参数,连接字符串str1和str2)
- 什么是特征向量,特征值,矩阵分解
- Fragment的onCreateView发生java.lang.IllegalStateException