Wednesday 15 May 2013

In ruby, how might I find all Files between two dates -


I am surprised that I did not find the answer to this question, but I have to choose between all the modified files between time. 1.day.ago Clearly I'm not expecting an 'first' operator, when ruby ​​files or files deal with the utility classes, but I would not be surprised if someone shows me. :)

The second way would be an array function that I think ... probably '& lt; = & Gt; Operator that I have never used

Maybe something like this? (Untested):

  selected_files = Dir.glob ("* .pdf"). Select | File | Mtime = file.mtime (file) # If in a Rail Environment: # (1.day.ago .. time.Now) .cover? (MEAT) # If the rail is not in the environment, but want to use that code before the line: # should math 'active_support / all' #: # mtime & gt; (Time.No, 86400) and Meet & LT; time. Now end    

No comments:

Post a Comment