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

We can also help with

CMS Governance Workflow

LFi Web Governance service runs inside your CMS to ensure all your checks & balances are complied with before your pages goes live.

Learn more

Multi-National Dashboards

Our dashboards allow you to spot trends in seconds. Customised by your business needs, you choose how our platform works for you.

Learn more

Content Audit

As LFi automates the audit of your website, it hugely speeds up the process of gathering the information you need.

Learn more
By |2017-10-05T16:15:22+00:00September 25th, 2008|Perl, TeamSite|0 Comments

About the Author: