diff --git a/bs_mirrorfull b/bs_mirrorfull index 1a647236..2a8fc426 100755 --- a/bs_mirrorfull +++ b/bs_mirrorfull @@ -12,6 +12,7 @@ use BSRPC ':https'; use BSXML; use BSHTTP; use Fcntl qw/:flock/; +use File::Path qw/make_path/; use strict; @@ -35,6 +36,10 @@ die("uasge: bs_mirrorfull url dir\n") unless @ARGV == 2; my ($url, $dir) = @ARGV; $url =~ s/\/$//; +unless (-d $dir) { + make_path($dir); +} + open(my $fh, '>', $dir.'/.lock') or die "failed to open lock file: $!\n"; unless(flock($fh, LOCK_EX|LOCK_NB)) { print "$dir is locked, waiting ...\n";