任何人都可以帮我一个Java代码,它将一个文件夹复制或移动到另一个文件夹中。
例如: 我有一个名为temp的文件夹,在temp我有一个文件夹in-temp 。
我希望我的temp文件夹应该被复制或移动到名为new temp的新文件夹中,但是使用Java代码。
我在Google上搜索了一个示例代码,它将一个文件夹的子目录和文件复制到一个新文件夹中,但正如我所说的,我需要将一个文件夹与其子文件夹一起移动到一个新文件夹中。
帮我解决这个问题。
谢谢。
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.
最满意答案
你可以使用apache-commons-io:
org.apache.commons.io.FileUtils.copyDirectory(File, File)You can use apache-commons-io:
org.apache.commons.io.FileUtils.copyDirectory(File, File)如何使用Java代码将文件夹(包括子目录和文件)移动到新文件夹中(How to move a folder(including subdirectories and files) into a new folder using Java code)任何人都可以帮我一个Java代码,它将一个文件夹复制或移动到另一个文件夹中。
例如: 我有一个名为temp的文件夹,在temp我有一个文件夹in-temp 。
我希望我的temp文件夹应该被复制或移动到名为new temp的新文件夹中,但是使用Java代码。
我在Google上搜索了一个示例代码,它将一个文件夹的子目录和文件复制到一个新文件夹中,但正如我所说的,我需要将一个文件夹与其子文件夹一起移动到一个新文件夹中。
帮我解决这个问题。
谢谢。
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.
最满意答案
你可以使用apache-commons-io:
org.apache.commons.io.FileUtils.copyDirectory(File, File)You can use apache-commons-io:
org.apache.commons.io.FileUtils.copyDirectory(File, File)
发布评论