Return to Snippet

Revision: 22910
at January 25, 2010 15:26 by TEHEK


Initial Code
#!/usr/bin/perl

sub cleanup {
        my $dir = shift;
	local *DIR;

	opendir DIR, $dir or return false;
	for (readdir DIR) {
	        next if /^\.{1,2}$/;
	        my $path = "$dir/$_";
		unlink $path if -f $path;
		cleanup($path) if -d $path;
	}
	closedir DIR;
	rmdir $dir;
	return true;
}


sub cleansvn {
	my $dir = shift;

	cleanup ("$dir/.svn");
	
	local *DIR;

	opendir DIR, $dir or die "opendir $dir: $!";
	for (readdir DIR) {
	        next if /^\.{1,2}$/;
	        my $path = "$dir/$_";
		cleansvn($path) if -d $path;
	}
	closedir DIR;
}


cleansvn(".");

Initial URL

                                

Initial Description
Can be used on any machine with PERL installed. Just execute this script in the directory and it will remove .svn folders recursively

Initial Title
Recursively remove .svn folders

Initial Tags
svn

Initial Language
Perl