Find all Branches in TeamSite

25 September 2008
by Gavin Colborne
The below script will look through all the branches in a TeamSite file system and simply list only the branches, not workareas or files and so on.

This script is by no means optimised and could run alot faster by doing checks in the “wanted” sub routine, but it does the job 🙂
This is useful when running ‘iwmigrate’ and other such tools recursively.
From the command line run the script passing the parameter of the top level branch to search from
Example Usage:
c:tempfind_all_branches.ipl y:defaultmain

#!C:Perlbinperl.exe -w
use strict;
use File::Find;
my ($area) = @ARGV;
my(@branches, $branch, $directory, @allDirectories);
find(&wanted, $area);
		foreach $directory(@allDirectories){
			if (-d $directory){
				next if ($directory =~ "WORKAREA" || $directory =~ "STAGING" || $directory =~ "EDITION");
					push @branches, $directory;
foreach $branch(@branches){
					print "Branch: $branchn";
sub wanted {
	push @allDirectories, $File::Find::name;
	return @allDirectories;

The output the script produces is a list of every branch it finds, such as:
Branch: c:TEMPbranches
Branch: c:TEMPbranches/default
Branch: c:TEMPbranches/default/main
Branch: c:TEMPbranches/default/main/test
Branch: c:TEMPbranches/default/main/test/sub-branch

Our Latest News