Definitely!
--
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
a>> I want to compare two directories and copy the files that are not in
a>>
Quote:
Quote:
>> a> directory $A to directory $B.
>>
o> Another way to do this from PowerShell that might be interesting :
o>
o> copy c:\test1\*.* c:\test2 -Exclude (dir c:\test2) -WhatIf
o>
o> Greetings /\/\o\/\/
o>
o> "Shay Levi" wrote:
o>
Quote:
Quote:
>> Hi akcorr,
>>
>> compare-Object $A $B | select InputObject
>>
>> Make sure to read Dmitry's post on the -syncWindow parameter:
>> http://dmitrysotnikov.wordpress.com/...object-gotcha/
>>
>> ---
>> Shay Levi
>> $cript Fanatic
>> http://scriptolog.blogspot.com
>> a> I want to compare two directories and copy the files that are not
>> in
>> a> directory $A to directory $B. My initial try to see what I get
>> back:
>> a>
>> a> $A = Get-ChildItem -path C:\test1
>> a> $B = Get-ChildItem -path C:\test2
>> a> $C = Compare-Object $A $B
>> a>
>> a> ForEach ($f in $C)
>> a> {
>> a> Write-Host $f
>> a> }
>> a> It Spit back this:
>> a>
>> a> @{InputObject=test.txt; SideIndicator=<=}
>> a> @{InputObject=test2.txt; SideIndicator=<=}
>> a> @{InputObject=test3.zip; SideIndicator=<=}
>> a> @{InputObject=test4.txt; SideIndicator=<=}
>> a> How would I got about extracting the fullnames for each of those
>> a> files? After that I can pass it to a function for work to be
>> done.
>> a>