ファイルの日付を一日ずつ増やす
「たのしいRuby」を読んで作ってみた。
引数で渡される最初のファイルの更新日時を基本に、それ以降のファイルの日時を基本日時から一日ずつ増やしていくスクリプト。
ラジオドラマ(青春アドベンチャー)の日付を付けるのが面倒だったけれど、これで幾分楽になるはず。
begin first_file = ARGV.shift file_date_time = File.mtime(first_file) ARGV.each {|file| file_date_time += 24 * 60 * 60 File.utime(file_date_time, file_date_time, file) } rescue => ex puts(ex.backtrace) print("(", ex.class, ") ", ex.message, "\n") printf("USAGE: %s file1, file2 ..\n", File.basename($0)) end