Created
January 11, 2019 07:09
-
-
Save sangheonhan/9bed1477d2ed40ff179eb2b420e0bcf2 to your computer and use it in GitHub Desktop.
특정 디렉토리 안의 svn 저장소들을 덤프하는 펄 스크립트
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/perl | |
use strict; | |
use warnings; | |
if ( $#ARGV < 0 ) { | |
print "Usage : dumpsvn.pl <svn root dir>\n"; | |
exit 1; | |
} | |
my $svndir; | |
my $dh; | |
my $filename; | |
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); | |
my $now = sprintf "%04d_%02d_%02d_%02d_%02d", $year + 1900, $mon + 1, $mday, $hour, $min; | |
$svndir = shift @ARGV; | |
opendir $dh, $svndir; | |
while ( $filename = readdir($dh) ) { | |
if ( -d "$svndir/$filename" && $filename !~ /^\.{1,2}$/ ) { | |
my $ifh; | |
my $ofh; | |
print "*** START - $svndir/$filename ***\n"; | |
open $ofh, '>', "svn_$filename.dump"; | |
open $ifh, '-|', "svnadmin dump $svndir/$filename"; | |
while ( <$ifh> ) { | |
print {$ofh} $_; | |
} | |
close $ifh; | |
close $ofh; | |
print "*** END - $svndir/$filename ***\n"; | |
} | |
} | |
closedir($dh) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment