Commit 76ca0364 authored by Robert Ricci's avatar Robert Ricci

Only copy in files that have been updated for this year

parent e45dcb02
......@@ -9,6 +9,7 @@ use strict;
sub transmogrify($);
sub cleanup(@);
sub setmtime($$);
sub getmyear($);
my $CLASSDIR = "class";
......@@ -22,6 +23,9 @@ my @others = ("syllabus", "schedule");
foreach my $file (@handouts, @lecturenotes) {
my $destfile = $CLASSDIR . "/" . transmogrify($file);
my $command = "cp $file $destfile";
if (getmyear($file) != 2015) {
next;
}
print "$command\n";
system "$command";
setmtime($destfile,$file);
......@@ -31,6 +35,9 @@ foreach my $file (@others) {
my $sourcefile = $file . "/" . $file . ".pdf";
my $destfile = $CLASSDIR . "/" . $file . ".pdf";
my $command = "cp $sourcefile $destfile";
if (getmyear($sourcefile) != 2015) {
next;
}
print "$command\n";
system "$command";
setmtime($destfile,$sourcefile);
......@@ -56,6 +63,18 @@ sub cleanup(@) {
return @list;
}
sub getmyear($) {
my ($sourcefile) = @_;
# Find out last modified time for the directory the source file was in
my $directory = `dirname $sourcefile`;
chomp $directory;
my $mtime = `git log -1 --format=%ct -- $directory`;
my @date = localtime($mtime);
return $date[5] + 1900;
}
sub setmtime($$) {
my ($file, $sourcefile) = @_;
# Find out last modified time for the directory the source file was in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment