Created
April 2, 2012 11:04
-
-
Save syonbori/2282671 to your computer and use it in GitHub Desktop.
listup the lacking files with date from and date to
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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