开发者

can i copy a directory from one place to another place directly?

开发者 https://www.devze.com 2022-12-15 11:19 出处:网络
Because many method which i have used does this, but they ll ultimately end up in copying each file by 开发者_JAVA技巧it conetents? as i have text files with lots of contents i will be a slow process?

Because many method which i have used does this, but they ll ultimately end up in copying each file by 开发者_JAVA技巧it conetents? as i have text files with lots of contents i will be a slow process?


You could use FileUtils from Apache Commons IO?


I would recommend something like FileUtils from Apache Commons IO.


I'm not sure if you want to move a directory, or or the files in it, but could you use renameTo and something like...

File origDir = new File("OrigDir");
File newDir = new File("NewDir");
origDir.renameTo(new File(newDir, origDir.getName()));
0

精彩评论

暂无评论...
验证码 换一张
取 消