posts - 56, comments - 54, trackbacks - 0, articles - 4
   ::  ::  :: 联系 :: 聚合  :: 管理

使用java复制移动文件

Posted on 2005-11-17 16:03 Terry的Blog 阅读(5238) 评论(2)  编辑  收藏 所属分类: java语言
    /**
     * Moving a File to Another Directory
     * @param srcFile  eg: c:\windows\abc.txt
     * @param destPath eg: c:\temp
     * @return success
     */
    public static boolean move(String srcFile, String destPath){
        // File (or directory) to be moved
        File file = new File(srcFile);
       
        // Destination directory
        File dir = new File(destPath);
       
        // Move file to new directory
        boolean success = file.renameTo(new File(dir, file.getName()));
       
        return success;
    }

评论

# re: 使用java复制移动文件[未登录]  回复  更多评论   

2008-01-04 11:49 by selina
thanks ,i'm success!

# re: 使用java复制移动文件  回复  更多评论   

2008-01-22 14:44 by 怎么羡慕天空的飞鸟
不错。性能应该比流的形式好点。

只有注册用户登录后才能发表评论。


网站导航: