ruby - How to check whether a File exists -
this question has answer here:
i have array of strings , want select these strings paths files:
my path "~/dlds/some_file.ics"
~/dlds
symlink ~/archive/downloads
on system. file has following permissions:
-rw-r--r--
my code (i tried several variants):
argv.select |string| file.file? string # returns false pathname.new(string).file? # returns false pathname.new(string).expand_path.file? # returns false end
i don't know else try.
i'm running ruby 2.2.0 or 2.2.2.
file.exist? file.expand_path "~/dlds/some_file.ics"
Comments
Post a Comment