Comparing CSV


we've migrated sharepoint 2013 , compare item count lists.

our sharepoint 2010 environment consists of 1 site collection. webs want collect list information under /clients.

our sharepoint 2013 environment consists of 2 site collections. split /archives/clients , /solutions/clients respectively.

during our migration, determined sites should put /archives/clients site collection, while others go /solutions/clients site collection.

i've created two csvs (one 2010, , 1 2013) output following list information: url (defaultviewurl), title, , count (itemcount). question best method compare these 2 csvs show difference between count column? want find lists show different count in 2013 environment 2010 one.

thanks,

below powershell used output library information sharepoint 2010.

$site = get-spsite -identity http://mysitecol $webs = $site.allwebs | where-object {$_.url -like "*clients*"} foreach ($web in $webs) {     $lists = $web.lists | where-object {$_.hidden -ne "true" -and $_.title -ne "tasks" -and $_.title -ne "workflow tasks"}     foreach ($list in $lists) {         $itemcount = $list.itemcount         $list.defaultviewurl + "," + $list.title + "," + $itemcount >> c:\temp\libs2010.csv     } }

below powershell used output library information sharepoint 2013.

$site = get-spsite -identity http://mysitecol/archives/clients $webs = $site.allwebs foreach ($web in $webs) {     $lists = $web.lists | where-object {$_.hidden -ne "true" -and $_.title -ne "tasks" -and $_.title -ne "workflow tasks"}     foreach ($list in $lists) {         $itemcount = $list.itemcount         $list.defaultviewurl.replace("/archives", "") + "," + $list.title + "," + $itemcount >> c:\temp\libs2013.csv     } }


yes need first compare  urls. code below assumes urls 2010 , 2013 same (if not you'll need adjust group expression accordingly):

$sp2013=import-csv "c:\temp\libs2013.csv"  $sp2010=import-csv "c:\temp\libs2010.csv"  compare-object $sp2010 $sp2013 -property url,count -passthru |  	group url |  	where {$_.count -eq 2} | foreach{ 		$ht=new-object system.collections.specialized.ordereddictionary 		$ht.url=$_.group[0].url 		$ht.count2010=($_.group | {$_.sideindicator -eq "<="}).count 		$ht.count2013=($_.group | {$_.sideindicator -eq "=>"}).count 		$ht.difference=[math]::abs($ht.count2010-$ht.count2013) 		new-object psobject -property $ht } 





Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

CRL Revocation always failed

Failed to query the results of bpa xpath

0x300000d errors in Microsoft Remote Desktop client