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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Listing the Files or Subdirectories in a Directory  RSS feed

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Report post to moderator
i am trying hard for this .
please anyone help me out.
i want to list the Files or Subdirectories in a Directory upto the bottom most level without even missing a single directory or even a file from the path that i give.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
  • Report post to moderator
Are you aware of the File class, and the listFiles() method? That would be a good place to start. Unfortunately that method does not list the contents of subdirectories. So: are you familiar with the idea of recursive methods? Have you ever written a recursive method? It's possible to write a fairly straightforward recursive method which lists the contents of all subdirectories. Or, you could just look at something like org.apache.commons.io.FileUtils, specifically the listFiles() methods. But really, writing your own recursive listFiles() method is probably more rewarding. If it seems difficult, it's probable a worthwhile excercise to learn from. If you get suck, we can help you through the details if you show us what you're trying so far. Good luck.
[ April 08, 2006: Message edited by: Jim Yingst ]
 
Marshal
Posts: 67197
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place.
 
rubbery bacon. crispy tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!