File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes recursive methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "recursive methods" Watch "recursive methods" New topic

recursive methods

Ravindra Suroju

Joined: Mar 11, 2008
Posts: 14
Hi all,

I want to print the absolute path of all files (including the files in subfolders) in a given directory [C:/Source]. Please help me what is wrong with my code...

Best Regards,<br />Ravindra.
Joanne Neal

Joined: Aug 05, 2005
Posts: 3742
What makes you thing there's something wrong with it ? Does it not compile (show us the error messages) or does it not do what you expected (tell us what it does do and how this differs from what you expected).

Bob Good
Ranch Hand

Joined: Jan 09, 2008
Posts: 86
1) Class names should begin with a capital (Test not test)
2) Instance variables should be non capitalized (directory not Directory, path not Path)
2) You have provided no comments
3) directory.getDirectoryList("/" + args[0]); <== corrected
4) File tempFile = new File(path + "/" + dirContents[i]); <== corrected

You were very close.
Ravindra Suroju

Joined: Mar 11, 2008
Posts: 14
Thanks so much Bob...
I agree. Here's the link:
subject: recursive methods
It's not a secret anymore!