Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
6.5 upgrade How do I count the number of branches?
Tim__D
We have a lot of branches. Is there a command line tool I can use to calculate this? I need to for the licence key.
Find more posts tagged with
Comments
jkm
You can use the following code probably :-)
Run it from any location and it will provide you the number of branches under that just change the workarea names etc in the condition
my $branch_cnt=0;
my
@contents
= map "$dir/$_", sort grep !/^\.\.?$/, readdir DIR;
&find_branch ($dir);
print "Number of Branches:: $branch_cnt";
sub find_branch
{
my
@contents
=
@_
;
foreach $dir_file (
@contents)
{
if ( -d $dir_file )
{
if( $dir_file !~ m#main_wa|WORKAREA|preview|EDITION|STAGING|web|templatedata|web_master# )
{
$branch_cnt++;
opendir DIR, $dir_file or print LOGFILE "\n Error in Opening DIR $dir_file : $!";
my
@content_loc
= map "$dir_file/$_", sort grep !/^\.\.?$/, readdir DIR;
closedir DIR ;
&find_branch (
@content_loc)
;
}
}
}
}
Adam Stoller
I think this is a bit cleaner ...
use strict;
use warnings;
use TeamSite::Config;
my $iwhome = TeamSite::Config::iwgethome();
my $archive = shift || "/default";
$archive .= "/main" if ($archive !~ m|^/[^/]+/main/?|);
print get_branch_count($archive);
exit 0;
sub get_branch_count{
my $dir = shift;
chomp(my
@branches
= qx($iwhome/bin/iwlist "$dir"));
my $count =
@branches
;
foreach(
@branches){
$count += get_branch_count("$dir/$_");
}
return $count;
}
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
jed
You might also want to add a call to "$iw-home/bin/iwstoreadm -l" to get all the stores being used...
--
Jed Michnowicz
jedm@sun.com
Content Management Engineering
Sun Microsystems
JeremyH
Or, if you have a pretty standard TeamSite installation on Unix, you could do a quick run with the shell. First cd to your /iwmnt directory and then run:
find . -name 'EDITION' -prune -o -name 'WORKAREA' -prune -o -name 'STAGING' -prune -type 'd' |grep EDITION|wc -l