- 浏览: 238245 次
- 性别:
- 来自: 上海
-
最新评论
-
iwindyforest:
pinocchio2mx 写道iwindyforest 写道H ...
VMware Workstation 11 或者 VMware Player 7安装MAC OS X 10.10 Yosemite -
nng119:
找不到设备的安装信息 这个问题怎么解决的?
VMware Workstation 11 或者 VMware Player 7安装MAC OS X 10.10 Yosemite -
pinocchio2mx:
iwindyforest 写道Hi pinocchio2mx ...
VMware Workstation 11 或者 VMware Player 7安装MAC OS X 10.10 Yosemite -
iwindyforest:
Hi pinocchio2mx 兄弟, 这个镜像是好的, 我安 ...
VMware Workstation 11 或者 VMware Player 7安装MAC OS X 10.10 Yosemite -
pinocchio2mx:
蛋疼啊,折腾一晚上还没搞定!网上的教程没一篇靠谱的,摸摸索索到 ...
VMware Workstation 11 或者 VMware Player 7安装MAC OS X 10.10 Yosemite
package com.iwindyforest.dir; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; public class FileSystem { private ArrayList<String> fileList = new ArrayList<String>(); public FileSystem(String path) { long a = System.currentTimeMillis(); this.listFiles(path); this.print("TimeCost:" + (System.currentTimeMillis() - a) + " Millis"); this.xCopy(path, "C:\\temp"); } private void print(String message) { System.out.println(message); } public void listFiles(String strPath) { File dir = new File(strPath); if(dir != null && dir.exists()) { if(dir.isDirectory()) { File[] files; try { files = dir.listFiles(); } catch(SecurityException e) { files = null; e.printStackTrace(); } if(files == null) { return; } else { for(int i = 0; i < files.length; i++) { String strFileName = files[i].getAbsolutePath(); if(files[i].isDirectory()) { this.print("D--:" + strFileName); this.listFiles(files[i].getAbsolutePath()); } else { this.print("F--:" + strFileName); fileList.add(files[i].getAbsolutePath()); } } } } else { this.print("F--:" + dir.getAbsolutePath()); } } else { this.print("FileNotExist:" + dir.getAbsolutePath()); } } private boolean checkDir(File dir) { if(dir == null) { this.print("dirPath is null"); return false; } else if(!dir.exists()) { this.print("dirPath: " + dir.getAbsolutePath() + " doesn't exist."); return false; } else if(!dir.isDirectory()) { this.print("dirPath: " + dir.getAbsolutePath() + " is not a directory."); return false; } else { return true; } } /** * 类似与windows操作系统的xCopy,递归拷贝整个源目录到目标目录。 源目录和目标目录必须已经存在。 * * @param srcDirPath * @param destDirPath */ public void xCopy(String srcDirPath, String destDirPath) { File srcDir = new File(srcDirPath); File destDir = new File(destDirPath); if(this.checkDir(srcDir) && this.checkDir(destDir)) { File[] files; try { files = srcDir.listFiles(); } catch(SecurityException e) { files = null; this.print("xCopy breaked: can't listFiles,may be caused by:"); e.printStackTrace(); return; } if(files == null) { return; } else { for(int i = 0; i < files.length; i++) { String fileName = files[i].getName(); String absoluteFileName = files[i].getAbsolutePath(); if(files[i].isDirectory()) { // 下一次递归的源目录 String subSrcDir = srcDir.getPath() + File.separator + fileName; // 下一次递归的目的目录 String subDestDir = destDir.getPath() + File.separator + fileName; try { new File(subDestDir).mkdir(); } catch(SecurityException e) { this.print("can't mkdir in path : " + subDestDir); this.print("xCopy breaked cause by: "); e.printStackTrace(); return; } xCopy(subSrcDir, subDestDir); } else { String destFileName = destDirPath + File.separator + fileName; copyFile(absoluteFileName, destFileName); } } } } } /** * 简单复制单个文件到目标路径。目标路径下的该文件必须有可写权限 * * @param srcFilePath * @param desFilePath */ public void copyFile(String srcFilePath, String desFilePath) { int byteread = 0; InputStream in = null; FileOutputStream out = null; try { in = new FileInputStream(srcFilePath); out = new FileOutputStream(desFilePath); } catch(FileNotFoundException e) { e.printStackTrace(); } byte[] buffer = new byte[1024]; try { while((byteread = in.read(buffer)) != -1) { out.write(buffer, 0, byteread); } in.close(); out.close(); } catch(IOException e) { e.printStackTrace(); } } public static void main(String[] args) { if(args.length == 1) { new FileSystem(args[0]); } else { new FileSystem(System.getProperty("user.dir", "c:\\")); } } }
- xcopy.rar (7.5 KB)
- 描述: java xCopy源代码
- 下载次数: 58
评论
2 楼
iwindyforest
2008-07-10
哦,谢谢EXvision的指点!
commons的FileUtils还没看到,所以不知道,
回去好好看下...
commons的FileUtils还没看到,所以不知道,
回去好好看下...
1 楼
EXvision
2008-07-09
很销魂的轮子哦.
commons的FileUtils貌似帮lz写好了这些。
commons的FileUtils貌似帮lz写好了这些。
发表评论
-
利用归并排序算法对大文件进行排序
2015-01-25 20:59 5665归并排序算法介绍,请参照Wikipeida zh. ... -
try-catch影响性能吗?
2014-07-09 17:06 1715try-catch会影响性能吗? try-catch放在循 ... -
Java Concurrency In Practice Learning Note
2014-06-17 11:13 0Frameworks introduce concurre ... -
Java collections overview
2014-03-21 10:37 896Fromp: http://java-performance ... -
JVM Learning Note 4 -- HotSpot JVM Options List
2014-02-26 11:08 1050From: http://www.oracle.c ... -
Eclispe 性能优化
2014-02-25 15:07 973我目前Eclipse所在的机器环境是windows x32 ... -
JVM Learning Note 3 -- JVM Performance Monitor Tools
2014-02-25 12:25 1198JDK Provided Tools Comman ... -
JVM Performance Monitor Tools
2014-02-25 11:12 5JDK Provide Tools Command Li ... -
JVM Learning Note 2 -- Garbage Collection and Memory Allocation Strategy
2014-02-18 14:57 1784Method to check if an object ... -
JVM Learning Note 1 -- Run-Time Data Areas and Object Representation
2014-02-11 00:44 905Run-Time Data Areas Clas ... -
String.intern()方法
2014-02-10 16:22 808intern public String intern() ... -
GlobalKnowledge: 2013 IT 技能薪水报告
2014-01-09 18:24 1896from: GlobalKnowledge http:/ ... -
OLTP Vs OLAP
2014-01-02 13:42 857OLTP vs. OLAP We can divide ... -
java的字符串拼接
2013-12-31 16:43 834每当我用+运算符拼接字符串时, 总有人跟我提出你应该 ... -
45 Useful JavaScript Tips, Tricks and Best Practices
2013-12-31 11:08 10240By Saad Mousliki ... -
面试10大算法汇总+常见题目解答
2013-12-16 18:03 2026面试10大算法汇总+常见题目解答 最近更新 ... -
面试关于HashMap的工作原理
2013-12-16 17:58 2001先来些简单的问题 “你用过HashMap吗?” ... -
处理 InterruptedException
2013-11-01 16:28 763这样的情景您也许并不陌生:您在编写一个测试程序,程序需要暂 ... -
Java正确处理InterruptedException的方法
2013-11-01 16:24 818要想讨论正确处理Interr ... -
Overview To CMMI v1.3
2013-07-05 18:15 935What is CMMI? CMMI® (Capa ...
相关推荐
资源内项目源码是来自个人的毕业设计,代码都测试ok,包含源码、数据集、可视化页面和部署说明,可产生核心指标曲线图、混淆矩阵、F1分数曲线、精确率-召回率曲线、验证集预测结果、标签分布图。都是运行成功后才上传资源,毕设答辩评审绝对信服的保底85分以上,放心下载使用,拿来就能用。包含源码、数据集、可视化页面和部署说明一站式服务,拿来就能用的绝对好资源!!! 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、大作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.txt文件,仅供学习参考, 切勿用于商业用途。
《基于YOLOv8的智慧社区独居老人生命体征监测系统》(包含源码、可视化界面、完整数据集、部署教程)简单部署即可运行。功能完善、操作简单,适合毕设或课程设计
Android Studio Meerkat 2024.3.1 Patch 1(android-studio-2024.3.1.14-mac.dmg)适用于macOS Intel系统,文件使用360压缩软件分割成两个压缩包,必须一起下载使用: part1: https://download.csdn.net/download/weixin_43800734/90557060 part2: https://download.csdn.net/download/weixin_43800734/90557056
侧轴承杯加工工艺编制及夹具设计.zip
NASA数据集锂电池容量特征提取(Matlab完整源码和数据) 作者介绍:机器学习之心,博客专家认证,机器学习领域创作者,2023博客之星TOP50,主做机器学习和深度学习时序、回归、分类、聚类和降维等程序设计和案例分析,文章底部有博主联系方式。从事Matlab、Python算法仿真工作8年,更多仿真源码、数据集定制私信。
板料折弯机液压系统设计.zip
C6150车床的设计.zip
机器学习之KNN实现手写数字
python爬虫;智能切换策略,反爬检测机制
mpls-vpn-optionA-all
56tgyhujikolp[
GB 6442-86企业职工伤亡事故调查分析规则.pdf
汽车液压式主动悬架系统的设计().zip
2000-2024年各省专利侵权案件结案数数据 1、时间:2000-2024年 2、来源:国家知识产权J 3、指标:专利侵权案件结案数 4、范围:31省 5、用途:可用于衡量知识产权保护水平
资源内项目源码是来自个人的毕业设计,代码都测试ok,包含源码、数据集、可视化页面和部署说明,可产生核心指标曲线图、混淆矩阵、F1分数曲线、精确率-召回率曲线、验证集预测结果、标签分布图。都是运行成功后才上传资源,毕设答辩评审绝对信服的保底85分以上,放心下载使用,拿来就能用。包含源码、数据集、可视化页面和部署说明一站式服务,拿来就能用的绝对好资源!!! 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、大作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.txt文件,仅供学习参考, 切勿用于商业用途。
内容概要:本文档详细复现了金融数学课程作业,涵盖欧式看涨期权定价和投资组合优化两大部分。对于欧式看涨期权定价,分别采用Black-Scholes模型和蒙特卡洛方法进行了计算,并对彩虹期权进行了基于最大值的看涨期权定价。投资组合优化部分则探讨了最小方差组合、给定收益的最小方差组合、最大效用组合以及给定风险的最大收益组合四种情形,还对比了拉格朗日乘数法和二次规划求解器两种方法。文中不仅提供了详细的MATLAB代码,还有详尽的中文解释,确保每一步骤清晰明了。 适合人群:金融工程专业学生、量化分析师、金融数学爱好者。 使用场景及目标:①帮助学生理解和掌握金融衍生品定价的基本原理和方法;②为从事量化分析的专业人士提供实用工具和技术支持;③作为教学材料辅助高校教师讲授相关内容。 其他说明:文档还包括了完整的论文结构建议,从封面页到结论,再到附录,涵盖了所有必要元素,确保提交的作业符合学术规范。此外,还特别强调了数据预处理步骤,确保代码可以顺利运行。
脉冲电解射流加工喷射装置设计(1)
ThinkPad S1 (2nd Generation) 和ThinkPad Yoga 260 用户指南V3.0,包含如何拆机更换硬件
charles描述文件下载
python代码-使用人类对话数据集lora微调deepseek