This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
    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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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
Sheriff
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 ]
 
Author and ninkuma
Marshal
Posts: 66804
168
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.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!