aspose file tools*
The moose likes Beginning Java and the fly likes file names Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "file names" Watch "file names" New topic
Author

file names

chris barrett
Greenhorn

Joined: Dec 20, 2005
Posts: 10
i want to check and see if there is a file with a certian name and i don't know how ...i don't want to read from the file just want to know the name of the file.
Stephen Foy
Ranch Hand

Joined: Oct 17, 2005
Posts: 143
you could try



Stephen Foy - Microsoft Application Development Consultant
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24168
    
  30

You could do that, although since throwing an exception is expensive, this is very inefficient (and as written, it leaves the FileReader open... not good!) But it would be much better to use the java.io.File.exists() method:



[Jess in Action][AskingGoodQuestions]
chris barr
Ranch Hand

Joined: Apr 20, 2006
Posts: 37
Thanks that helped alot.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: file names
 
Similar Threads
documentbase
how to get package and class name?
how to invoke a java program using shellscript
variable names
Passing data back and forth between classes