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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

android - How to create dynamically Fragment pager adapter -