Skip to content

Instantly share code, notes, and snippets.

@syonbori
Created April 2, 2012 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syonbori/2282671 to your computer and use it in GitHub Desktop.
Save syonbori/2282671 to your computer and use it in GitHub Desktop.
listup the lacking files with date from and date to
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment