How can I recursively delete all .svn directories using Perl?

What would a Perl script look like that would take a directory, and then delete all .svn directories in that directory recursively?

(No shell, cross platform)


You can (and probably should) use svn export in the first place.

Otherwise, use File::Find and File::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 /^.svnz/;
    rmtree(catfile $File::Find::name, '.svn');
    return;
}
链接地址: http://www.djcxy.com/p/54578.html

上一篇: 我如何知道Perl模块是核心还是标准安装的一部分?

下一篇: 我如何递归删除使用Perl的所有.svn目录?