This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes FileVisitResult Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "FileVisitResult" Watch "FileVisitResult" New topic
Author

FileVisitResult

meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305


java.nio.file
Enum FileVisitResult

SKIP_SIBLINGS
Continue without visiting the siblings of this file or directory.
SKIP_SUBTREE
Continue without visiting the entries in this directory.


I do understand SKIP_SUBTREE, but how SKIP_SIBLINGS is different from that ?

Thanks


My one regret in life is that I am not someone else.
- Woody Allen
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2339
    
  50
Have you tried writing some code to see what the difference is?
meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305

Tony Docherty wrote:Have you tried writing some code to see what the difference is?


I tried this.


Initiating root
Initiating dir1
D:\OCJP7\IO\FileIO(WithNIO2)\FileVisitor\root\dir1\dir1file.txt
End of dir1
Initiating dir2
End of root


Initiating root
Initiating dir1
D:\OCJP7\IO\FileIO(WithNIO2)\FileVisitor\root\dir1\dir1file.txt
End of dir1
Initiating dir2
D:\OCJP7\IO\FileIO(WithNIO2)\FileVisitor\root\rootfile.txt
End of root



[untitled.JPG]

Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2339
    
  50
So has that answered your question?
meeta gaur
Ranch Hand

Joined: Dec 05, 2012
Posts: 305

Tony Docherty wrote:So has that answered your question?
Getting something but not whole.I can get same effect with SKIP_SIBLINGS=(pre)SKIP_SUBTREE+(post)TERMINATE
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2339
    
  50
There probably are several ways to get the same effect by returning combinations of values from different methods, the FileVisitor is very versatile.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: FileVisitResult