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

Popular posts from this blog

1111. appearing after print sequence - php -

excel - I can't get the attachement of the email PHP -

node.js - Express and Redis - If session exists for this user, don't allow access -