Guest User

Untitled

a guest
Sep 22nd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #!/usr/bin/ruby
  2. require 'date'
  3.  
  4. _date_from = ARGV[0]
  5. _date_to = ARGV[1]
  6. target_dir = ARGV[2]
  7.  
  8. if _date_from.nil? or _date_to.nil?
  9. STDERR.puts "please specify the date_from and date_to."
  10. exit 1
  11. end
  12.  
  13. date_from = date_to = nil
  14. begin
  15. date_from = Date.parse(_date_from)
  16. date_to = Date.parse(_date_to)
  17. rescue
  18. STDERR.puts "failed. #{$!}"
  19. exit 1
  20. end
  21.  
  22. the_day = date_from
  23. while (the_day <= date_to)
  24. str_ptn = the_day.strftime("%Y%m%d")
  25. glob_ptn = "#{target_dir}/*#{str_ptn}*"
  26. if Dir.glob(glob_ptn).empty?
  27. puts str_ptn
  28. end
  29. the_day = the_day.succ
  30. end
Add Comment
Please, Sign In to add comment