View Single Post
Old 10-11-2007   #1 (permalink)
hrh1818


 
 

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

In Powershell if I have the following two arrays:
$a = 'file1', 'file2', 'file3'
$b = 'file2', 'file3', 'file4'
The operation $a - $b produces a method not implemented error.

Whereas in Ruby if I have the following two arrays:
a = ['file1', 'file2', 'file3']
b = ['file2', 'file3', 'file4']
The operation a - b produces the output ["file1"]
and the operation b - a produces the output ["file4"]

This use of the subtraction operator in Ruby is very useful when
creating a list of files that have been deleted or added to a
directory. What method in Powershell will produce the same results as
a - b does with arrays in Ruby?

Howard

My System SpecsSystem Spec