Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare-object to a text file

Status
Not open for further replies.

hwood125

Technical User
May 29, 2009
7
US
I am trying to compare files between two different folders and then if there are differences I would like to output it to a txt file. Right now I can show the differences but I am unable to write the results in the txt file.

Here is what I have so far:

foreach($file in dir)
{
$fileName = "c:\SPScripts\$file"
$fileName2 = "c:\SPScripts_02\$file"
compare-object -referenceobject $(get-content $FileName) $(get-content $FileName2) -property Name, $fileName, $fileName2, length
| Out-File "c:\Yo_02.txt" -append
}

Thanks!
 
You might see if anything in this thread is helpful: thread1619-1513137
 
Also, are you getting anything in the text file at all? Are you getting any error messages?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top