• Post Reply Bookmark Topic Watch Topic
  • New Topic

general  RSS feed

 
karthik mama
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear friends,
may i know if it is possible to get the names of the files present in a directory as inputs?? as i have a large list of files in a directory which are to be converted into a standard format......

plzzz help soon
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch!

In an effort to help you get the most from our forums, we've compiled a
list of tips for asking questions here. You can find the list in our
FAQ section here.
In particular please see:
UseRealWords
Abbreviations such as "u" or "ur" in
place of "you" and "you are" or "you're" confound language translation software making
it hard for our non-English speaking members to read your posts.
"plz" is not a word in the English language.

You'll also find that people respond better if your questions have meaningful subject lines.

You asked a specific question about reading files in a directory. Your subject line of "general" does nothing to describe this question.
UseAMeaningfulSubjectLine
Again, welcome to JavaRanch and good luck with your question.
-Ben
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16059
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by karthik mama:
may i know if it is possible to get the names of the files present in a directory as inputs??

I don't know exactly what you mean, but class java.io.File has methods to list the files and directories in a directory. See the API documentation for details.

Also, this question doesn't seem to have anything to do with Tomcat. I am moving it to the Java in General (Beginner) forum; please click the link above to continue the discussion.
 
Kaydell Leavitt
Ranch Hand
Posts: 690
Eclipse IDE Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear friends,
may i know if it is possible to get the names of the files present in a directory


As Jesper said, you need to look into the API documentation for the File class. The methods that list the files and directories of a directory are called list().

Note that the File class is not necessarily a file, an object of the class File may be either a file or a directory. There are methods that tell you whether a File object is a file or a directory.

isFile()
isDirectory()
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kaydell Leavitt:
There are methods that tell you whether a File object is a file or a directory.

isFile()
isDirectory()



... or neither. Remember that a File object can be created for any file or folder name that would be legal on the platform. It does not have to represent a currently-existing file or folder. The isFile() and isDirectory() will tell you whether the File does represent a currently-existing file or folder.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!