This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes use walkFileTree to copy all the directory and files in the sub-directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "use walkFileTree to copy all the directory and files in the sub-directory" Watch "use walkFileTree to copy all the directory and files in the sub-directory" New topic
Author

use walkFileTree to copy all the directory and files in the sub-directory

leometal Chen
Greenhorn

Joined: Dec 02, 2013
Posts: 8
I found the example in <java se 7 programmer exam...> for Revisiting File Copy,when I execute it and found the source directory and the files inside are copied into directories no any files inside.
For example, there is a Test.java file in the source directory and it will be copied as a named Test.java directory.

I would like to know what is the problem in side,thanks a lot!

code as follow:

leometal Chen
Greenhorn

Joined: Dec 02, 2013
Posts: 8
thank you,I already found the problem that Files.copy(source parameter should be path)

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: use walkFileTree to copy all the directory and files in the sub-directory
 
Similar Threads
simpleFileVisitor cant write to text file?
FileVisitResult
WatchService API
Files.walkFileTree doesn't check all the directories
File Traversal