2009-11-18 102 views

回答

14

可以(并且可能应该)首先使用svn export

否则,使用File::FindFile::Path::rmtree

#!/usr/bin/perl 

use strict; use warnings; 

use File::Find; 
use File::Path qw(rmtree); 
use File::Spec::Functions qw(catfile); 

find(\&rm_dot_svn, $_) for @ARGV; 

sub rm_dot_svn { 
    return unless -d $File::Find::name; 
    return if /^\.svn\z/; 
    rmtree(catfile $File::Find::name, '.svn'); 
    return; 
} 
+0

Path :: Class是否带有标准安装? – 2009-11-18 13:56:02

+1

不,但您可以使用'File :: Spec'来代替。 – 2009-11-18 13:58:46

+1

太棒了!谢谢。出于某种原因,我不得不使用rmtree()来切换remove_tree,但之后它运行得非常好。 – 2009-11-18 14:07:06