-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgetfile.pl
executable file
·49 lines (38 loc) · 1 KB
/
getfile.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/perl -w
use strict;
# Beeb Utilities to manipulate MMB and SSD files
# Copyright (C) 2012 Stephen Harris
#
# See file "COPYING" for GPLv2 licensing
use FindBin;
use lib "$FindBin::Bin";
use BeebUtils;
@ARGV=BeebUtils::init_ssd(@ARGV);
my $merge=0;
if (@ARGV && $ARGV[0] eq '-merge')
{
$merge=1; shift @ARGV;
}
my $overwrite=0;
if (@ARGV && $ARGV[0] eq '-overwrite')
{
$overwrite=1; shift @ARGV;
}
die "Syntax: $BeebUtils::PROG filename.ssd [-merge] [-overwrite] destdir [filename_regexp]\n" if $BeebUtils::BBC_FILE eq "" || !@ARGV;
my $destdir=$ARGV[0];
my $filter='^.*$';
if (defined $ARGV[1]) {
$filter = $ARGV[1];
}
if ($merge)
{
if (!-d $destdir) {
mkdir($destdir) || die "mkdir $destdir: $!\n";
}
} else {
die "$destdir already exists\n" if -e $destdir;
mkdir($destdir) || die "mkdir $destdir: $!\n";
}
my $image=BeebUtils::load_external_ssd(undef,0);
chdir($destdir) || die "chdir $destdir: $!\n";
BeebUtils::save_all_files_from_ssd(\$image,1,$overwrite,$filter);