<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Personal Weblog of John Wood &#187; tips</title>
	<atom:link href="http://www.webofwood.com/tag/tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webofwood.com</link>
	<description>Wordpress weblog of John Wood, a Database Administrator</description>
	<lastBuildDate>Fri, 13 Aug 2010 18:52:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Tips &amp; Tricks Using Compare-Object &#8211; Copy New Files</title>
		<link>http://www.webofwood.com/2009/07/29/tips-tricks-using-compare-object-copy-new-files/</link>
		<comments>http://www.webofwood.com/2009/07/29/tips-tricks-using-compare-object-copy-new-files/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 15:57:32 +0000</pubDate>
		<dc:creator>Woody</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[compare]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.webofwood.com/2009/07/29/tips-tricks-using-compare-object-copy-new-files/</guid>
		<description><![CDATA[This is a wonderful article which not only details the use of Compare-Object but also provides some very excellent examples on its use. Tips &#38; Tricks Using Compare-Object &#8211; Dreaming in PowerShell &#8211; PowerShell.com I am very new to PowerShell but I am beginning to like using it considerably more each day. I recently had [...]]]></description>
			<content:encoded><![CDATA[<p>This is a wonderful article which not only details the use of Compare-Object but also provides some very excellent examples on its use.</p>
<p><a href="http://powershell.com/cs/blogs/tobias/archive/2009/01/09/tipps-amp-tricks-using-compare-object.aspx">Tips &amp; Tricks Using Compare-Object &#8211; Dreaming in PowerShell &#8211; PowerShell.com</a></p>
<p>I am very new to PowerShell but I am beginning to like using it considerably more each day. I recently had a need for a quick and easy way to script a process which would copy only new files from one location to another. after scouring the Internet for a good example, I stumbled upon the Compare-Object cmdlet and this <a title="Compare-Object" href="http://powershell.com/cs/blogs/tobias/archive/2009/01/09/tipps-amp-tricks-using-compare-object.aspx" target="_blank">excellent article</a>.</p>
<p>The actual script I came up with is rather simple and serves my purpose exactly. As I  mentioned, I am new to PowerShell and there may very well be a better method. However, this one works for me.</p>
<h3>The script code:</h3>
<pre class="brush: ps">param(
    [string]$s = '\\serverx\c$\ProgramData\Polaris\3.5\SQLVS1\AuthorityUpdates',
    [string]$t = '\\servery\data03\shared\libraries\zmarc'
)

$target = Get-ChildItem $t
$source = get-childitem $s
Compare-Object $source $target -Property Name -PassThru |
    Where-Object { $_.SideIndicator -eq '&lt;=' } |
    foreach-object -process{
        copy-item $_.FullName -destination $t
        }</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.webofwood.com/2009/07/29/tips-tricks-using-compare-object-copy-new-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
