Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within I/O and Streams
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
I/O and Streams
File Directory access
Dan Lynch
Ranch Hand
Posts: 47
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi all,
Im wondering if I can access the files in a particular. What I mean is I know the directory I want to access but can I have some loop that returns the names of all the files in that directory.
Cheers
Dan
Shyam Prasad Murarka
Ranch Hand
Posts: 209
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Dear Dan,
After I read your problem I quickly searched throught a code that I had once downloaded and I found the answer you were seeking.
String path = "blahblah"; File file = new File(path); String fileList[] = [B]file.list()[/B]; //You can also pass an object of //FilenameFilter to filter the files for() { //Do your task Also you can check whether the [I]file in the array is a directory or not[/I] by [B]fileList[i].isDirectory()[/B] }//end of for
With Best Regards,
Shyam Prasad Murarka
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
I like...
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Better than searching through old source code is learning to use the
Java
API documentation.
[Jess in Action]
[AskingGoodQuestions]
The happiness of your life depends upon the quality of your thoughts -Marcus Aurelius ... think about this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
javac -classpath
File reading from any path
how upload all files in a local folder to server
Directory / File not found
Setting up classpath on a bat file
More...