开发者

How to move a folder(including subdirectories and files) into a new folder using Java code

开发者 https://www.devze.com 2023-02-16 04:39 出处:网络
Can anyone help me for a Java code which copy or move one folder as开发者_运维问答 it is into another folder.

Can anyone help me for a Java code which copy or move one folder as开发者_运维问答 it is into another folder.

For example:

I have a folder named temp, inside temp I have a folder in-temp.

I want that my temp folder should be copied or moved into a new folder named new temp, but by using Java code.

I got an example code by searching on Google which copies the sub-directories and files of a folder into a new folder, but as I said I need to move a folder with it's sub-folder into a new folder.

Help me to resolve this.

Thank you.


You can use apache-commons-io:

org.apache.commons.io.FileUtils.copyDirectory(File, File)
0

精彩评论

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

关注公众号