Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Powershell Script Not putting any data in output

$
0
0

I have a powershell script that matchs a text file with file names to a directory consisting of data files On the first match between these 2 it should copy the matched file in the directory to another directory.'

The text file consists of file names only    The directory consists of the text data for these file name

test1.txt                                                   test4

test2.txt                                                   test3

test3.txt                                                   test5

Inside test2 test3 and test3 are DB deployments scripts.

Since test3 is the first match the data file test3 should move to an output directory but its not 

Here is my script

$objFolder = "C:\Serena\ReleaseAutomationAgent\core\var\work\ABS_SQL\"  #(directory)
$objFile = "C:\Serena\ReleaseAutomationAgent\core\var\work\tmp\compare2.txt" #(File)
$outFile ="C:\Serena\ReleaseAutomationAgent\core\var\work\ABS_SQL\deploy\"  #Output Directory
Compare-Object -ReferenceObject (gc $objFile) -DifferenceObject (gci $objFolder|select -ExpandProperty Name) -ExcludeDifferent -IncludeEqual|select -first 1 -Expand InputObject | %{Copy-Item "objFolder\$_" -Dest $outFile}

Any help on this would be appreciated


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>