I work in an environment where it’s necessary to dupe SVN projects quite frequently. To do so, I like to copy and paste parts of the tree wherever and whenever, which requires that I remove the .svn folders. I have quick keys set up to take the file path from the clipboard and run this process in the background – easier than using a tool like ransack every time.
I use this framework for all kinds of recursive operations, like renaming images, etc.
#!usr/bin/perl use File::Path; $filePath = 'C:Documents and SettingsuserDesktopAssets'; $filePath =~ s/\///g; @dir = (); push(@dir, $filePath); foreach my $cur_dir (@dir) { &renameFiles($cur_dir); } #scanDirForInvalidNames sub renameFiles($dir) { my $dir = $_[0]; print "Processing: $dirn"; foreach my $file (&getDirectoryList($dir)) { if (-d $file) {#Is Directory? if ($file !~ /./) { #Is Directory AND NOT a .-file push(@dir, $file); } else { if ($file =~ /.svn/) { $pattern = '//'; $pattern2 = '/'; $file =~ s/$pattern/$pattern2/g; $file =~ s/ / /; print "####DELETED###".$file."n"; rmtree([$file]); } } } } } #getDirectoryList sub getDirectoryList($path) { my $path = $_[0]; $path =~ s/ /\ /g; #Correct Path Errors by escaping spaces. C:/Documents and Settings/* will become C:/Documents and Settings/* $path2 = $path; if (!($path =~ /*/)) { $path = $path.'/*'; } #Append the characters '*' to enable the glob if (!($path2 =~ /*/)) { $path2 = $path2.'/.*'; } #Append the characters '*' to enable the glob #RETURNS HIDDEN FILES .svn, etc. #print $path."n".$path2."n"; return glob($path.' '.$path2); }

