Need to compare source directory $source to $dest to see what .wav files are in source but not target.  I want to copy those files that are not in target to the target AND to a third directory $sharefolder   Here is what I have so far.  It appears that the copy-item is putting all of the differences into one copy string:

$sharefolder = '\\isilon1\blob\partial_dictation'
$comparefolder = '\\isilon1\blob\partial_dictation_compare'
$source = Get-childitem \\isilon1\blob\dcbld\pv -filter *.wav -recurse
$dest = Get-ChildItem \\isilon1\blob\Partial_Dictation_Compare -filter *.wav -recurse
$diff = Compare-Object $dest $source -passthru | Where-Object {$_.SideIndicator -EQ "=>"} | % {$_.FullName}
ForEach-Object { 

Copy-Item "$diff" "$comparefolder" -WhatIf
Copy-Item "$diff" "$sharefolder" -WhatIf

This is what I get if I echo $diff ; 

This is correct as these files are not in the destination.  When the copy-item runs, it gives this:  
Copy-Item : Cannot find path '\\isilon1\blob\dcbld\pv\-D\CB\LD\-9\94\1.wav   \\isilon1\blob\dcbld\pv\-D\CB\LD\-9\94\2.wav' because it does not exist.

I am coming from Unix so this is new to me.  Any thougts? Suggestions??
0 Comments   [ - ] Hide Comments


Please log in to comment

Answer this question or Comment on this question for clarity


robocopy 1stfolder 2ndfolder /E
robocopy 2ndfolder 3rdfolder /MIR
Answered 05/08/2015 by: flip1001
Third Degree Brown Belt

Please log in to comment