Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- require 'date'
- _date_from = ARGV[0]
- _date_to = ARGV[1]
- target_dir = ARGV[2]
- if _date_from.nil? or _date_to.nil?
- STDERR.puts "please specify the date_from and date_to."
- exit 1
- end
- date_from = date_to = nil
- begin
- date_from = Date.parse(_date_from)
- date_to = Date.parse(_date_to)
- rescue
- STDERR.puts "failed. #{$!}"
- exit 1
- end
- the_day = date_from
- while (the_day <= date_to)
- str_ptn = the_day.strftime("%Y%m%d")
- glob_ptn = "#{target_dir}/*#{str_ptn}*"
- if Dir.glob(glob_ptn).empty?
- puts str_ptn
- end
- the_day = the_day.succ
- end
Add Comment
Please, Sign In to add comment