`
xiuying
  • 浏览: 537228 次
  • 性别: Icon_minigender_1
  • 来自: 福建
社区版块
存档分类
最新评论

java移动文件

    博客分类:
  • java
阅读更多
  //文件原地址
  File oldFile = new   File("c:/test.xls");  
  //文件新(目标)地址
  String newPath = "c:/test/";  
  //new一个新文件夹
  File fnewpath = new File(newPath);
  //判断文件夹是否存在 
  if(!fnewpath.exists())  
          fnewpath.mkdirs(); 
  //将文件移到新文件里
  File fnew = new File(newPath +oldFile.getName());  
  oldFile.renameTo(fnew);
分享到:
评论
2 楼 maimode 2012-06-18  
嗯,受用了。
1 楼 huqing2010 2012-02-23  
不灵!

相关推荐

Global site tag (gtag.js) - Google Analytics