• Welcome to Valhalla Legends Archive.
 

Existance of files...

Started by iago, January 27, 2004, 08:19 AM

Previous topic - Next topic

iago

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
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Tuberload

Quote"Pray not for lighter burdens, but for stronger backs." -- Teddy Roosevelt
"Your forefathers have given you freedom, so good luck, see you around, hope you make it" -- Unknown