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

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -