View Single Post
Old 10-11-2007   #5 (permalink)
Kiron


 
 

Re: Creating a list of files that have been deleted from or added to a directory

Use where-object and -notContains to compare the collections:

$a = 'file1', 'file2', 'file3'
$b = 'file2', 'file3', 'file4'

$a | where-object {$b -notContains $_}
$b | where-object {$a -notContains $_}

# create a function
function RubySubtraction ([array]$a, [array]$b)
{
$a | where-object {$b -notContains $_}
}

# set its alias
set-alias ruby`- RubySubtraction

# call the function
RubySubtraction $a $b

# call the functi9n through its alias
ruby- $b $a

--
Kiron
My System SpecsSystem Spec