Valhalla Legends Archive

Programming => General Programming => Java Programming => Topic started by: iago on January 27, 2004, 08:19 AM

Title: Existance of files...
Post by: iago on January 27, 2004, 08:19 AM
Is there some easy way to check whether or not a file exists?  As far as I can tell, the best way to do it (without using an exec()) is to try to open it to read from it and let it throw an exception.  

What I want to be able to do is, if a user tries to create a file names MrFile.txt, and it already exists, to make it MrFile_1.txt, if that exists, make it MrFile_2.txt, etc. until it finds one.  Is there some easy way to do that?

Thanks!
-iago
Title: Re:Existance of files...
Post by: Tuberload on January 27, 2004, 10:40 AM
I believe File.exists()...