View Single Post
Old 10-11-2007   #2 (permalink)
Brandon Shell [MVP]


 
 

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

Perhaps Compare-Object is what your looking for?

Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject

h> In Powershell if I have the following two arrays:
h> $a = 'file1', 'file2', 'file3'
h> $b = 'file2', 'file3', 'file4'
h> The operation $a - $b produces a method not implemented error.
h> Whereas in Ruby if I have the following two arrays:
h> a = ['file1', 'file2', 'file3']
h> b = ['file2', 'file3', 'file4']
h> The operation a - b produces the output ["file1"]
h> and the operation b - a produces the output ["file4"]
h> This use of the subtraction operator in Ruby is very useful when
h> creating a list of files that have been deleted or added to a
h> directory. What method in Powershell will produce the same results
h> as a - b does with arrays in Ruby?
h>
h> Howard
h>


My System SpecsSystem Spec