From: Holden Glova Date: 2001-01-17T07:06:01+09:00 Subject: [ruby-talk:9397] Re: fileExists function? -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Chris, On Wed, 17 Jan 2001 03:30, I think Morris, Chris wrote: > I'm looking for a fileExists function and coming up short at the moment. > > I tried this: > > if !File.stat('sample.txt').file? > > .... but the File.stat method raises an exception, skipping my if test. I > could trap the exception, but that seems a bit much. Perhaps this is what you want? FileTest.exist?(filename) OR FileTest.exists?(filename) - -- Signed, Holden Glova -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.4 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE6ZMUVzrxa+Gy/b/4RAo1iAJ93mMKvem1VZj62cYMKV2Ybt4NAYACfSN39 J/YYUOtbHMa0ZoHz+YgLyyY= =JxxU -----END PGP SIGNATURE-----