`
zjutsoft
  • 浏览: 454651 次
  • 性别: 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);
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics