#!env perl
use strict;
use warnings;
use v5.16.0;
use autodie;

use File::Copy ();

sub fixdate {
	my $fromdate = shift;
	my $todate = shift;
	for my $page (1..4) {
		my $from = datefile($fromdate, $page);
		my $to = datefile($todate, $page);
		say "mv $from $to";
		#File::Copy::move($from, $to) or die "Can't move $fromdate: $!";
	}

}

sub datefile {
	my $date = shift;
	my $page = shift;
	return sprintf("hw%s-%02.02d.jpg", $date, $page);
}

my $datemap = {
	'20140916' => '20140610',
	'20140917' => '20140611',
	'20140918' => '20140612',
	'20140919' => '20140613',
	'20140920' => '20140614',
	'20140921' => '20140615',
	'20140922' => '20140616',
	'20140923' => '20140617',
};

foreach my $date (sort keys %{$datemap}) {
	fixdate($date, $datemap->{$date});
}
