#!/usr/bin/perl # save_state.pl -- author: Oliver Bossert # Copyright (C) 2004 Oliver Bossert # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. use strict; use warnings; use File::Find; use Digest::MD5; my $FILE = ".savedates"; my @data = (); find sub { my ($atime, $s_time) = (stat($_))[8,9]; my $omd5 = Digest::MD5->new; open(F, $_) or die "Can't open '$_': $!"; binmode(F); while () { $_ =~ s/date\" content=\"[^\"]+\"//; $omd5->add($_); } my $md5 = $omd5->b64digest; #Digest::MD5->new->addfile(*F)->hexdigest; close F; push @data, [$File::Find::name, $md5, $atime, $s_time]; }, "."; open (F1, ">.savedates") or die "Could not write to file!"; foreach my $d ( @data ) { print F1 join("\t", @{$d}) . "\n"; } close F1;