16
16
open(INFILE, "$ARGV[0]");
17
17
foreach $line (<INFILE>)
22
($md5, $name, $other) = split (/\|/, $line);
23
$key = $name . ".png";
24
$builtin{$key} = $key;
22
($md5, $name, $other) = split (/\|/, $line);
23
$key = $name . ".png";
24
$builtin{$key} = $key;
34
34
foreach $file (@files)
36
($base,$path,$type) = fileparse($file);
37
$directory{$base} = $base;
36
($base,$path,$type) = fileparse($file);
37
$directory{$base} = $base;
40
40
# All files in %builtin but not in %directory are 'missing' snapshots
41
41
while(($key, $value) = each(%builtin))
43
if(!defined $directory{$key})
43
if(!defined $directory{$key})
49
49
# All files in %directory but not in %builtin are redundant, and should be deleted
50
50
while(($key, $value) = each(%directory))
52
if(!defined $builtin{$key})
54
$file = $ARGV[1] . "/" . $key;
52
if(!defined $builtin{$key})
54
$file = $ARGV[1] . "/" . $key;
60
60
print "Missing snapshots: ($size)\n\n";
63
@missing = sort(@missing);
64
foreach $file (@missing)
63
@missing = sort(@missing);
64
foreach $file (@missing)
71
71
print "\n\nExtra snapshots: ($size)\n\n";
74
@delete = sort(@delete);
75
foreach $file (@delete)
74
@delete = sort(@delete);
75
foreach $file (@delete)
80
print "\nDelete extra snapshots [yN]: ";
81
chomp ($input = <STDIN>);
84
foreach $file (@delete)
86
$cmd = "rm \"$file\"";
80
print "\nDelete extra snapshots [yN]: ";
81
chomp ($input = <STDIN>);
84
foreach $file (@delete)
86
$cmd = "rm \"$file\"";
94
print "prune_snapshots.pl [listrominfo data] [snapshot dir]\n";
94
print "prune_snapshots.pl [listrominfo data] [snapshot dir]\n";