• Post Reply Bookmark Topic Watch Topic
  • New Topic

I need read a directory, capture all the file names and write them to a text file.  RSS feed

 
Nelson Cardoso
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I'm working on a project where I'm required to go through a directory (windows) and write each filename in that director to a text file.
I'm new to this, so please bare with me. Can someone give me a base to work with... I'm stumped on where to start.
Regards and Thank you for your time!
Nelson
 
James Swan
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This thread shows you have to get a list of files for a directory.
http://www.javaranch.com/ubb/Forum38/HTML/000624.html
Do you need help writing to a text file as well?
James.
 
Nelson Cardoso
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, thanks for your patience with a newby!!! ... and yes, I do need to write this to a text file... any help would be amazing!!!
Regards
Nelson
 
James Swan
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, just some quick code to get you started:

Check out the java.io package for more details: http://java.sun.com/j2se/1.3/docs/api/java/io/package-summary.html
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!