On Wed, Mar 22, 2017 at 9:44 AM, JuhiMarcel LangbroekTimmerman <
mt195...@gmail.com> wrote:

> As a side note I would test for existence only using .e because a
> directory could exist by that same name. Method .f would return False
> following an attempt to create a file which will fail.


  Depends what you're trying to do.

  Guarantee that the file exists, and is a file?  Then test with .f, and
let the creation attempt throw an exception.

  Guarantee that a file or directory exists?  Then test with .e, as you
suggest.

  Guarantee that a file or directory exists, and update the atime and
mtime, as touch(1) would?  Uh, hang on, ought $filename.IO.modified et al
to be mutable? :)

  (Eh, 99% of the time, I'd just shell out in this case.)


Eirik

Reply via email to