Solved

vbscript and File Compare

Posted on 2002-05-23
11
2,448 Views
Last Modified: 2008-06-18
Remember the old dos command FC?

How would I do that in VBS for a binary comparison?

Thanks
0
Comment
Question by:dds110
  • 4
  • 2
  • 2
  • +3
11 Comments
 
LVL 6

Expert Comment

by:Nitin Sontakke
ID: 7029933
If you could tell the place and purpose of it, it could help. File compare as a program is there in Windows as well in Visual Studio Tools, WinDiff.

Are you planning to use it strictly for binary files? If not, do have a look at FileSystemObject implementation, it could help.

Nitin.
0
 
LVL 20

Accepted Solution

by:
hes earned 25 total points
ID: 7030041
This example should work in vbs

http://www.coderoom.com/file_util_vb3.html
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7030066
Do you need to know if they are changed?
0
 
LVL 8

Author Comment

by:dds110
ID: 7030091
Once a week I move a large file to an archive server.  Before I delete the original copy, I run fc through the command prompt to ensure It got there in good shape.  I am trying to write a script that will do this for me.  The reason for the vbs script is this:  I "have" to prompt for the names of the files.  I'm using Winnt and my company is too cheap to buy VS.  The example that Hes suggested looks viable, but I'm not completely sold on it.  I need to FC the two files to ensure that there was no change from one server to the archive server.  I prefer to do this with the binary switch.  
0
 
LVL 8

Author Comment

by:dds110
ID: 7030435
Found a good solution, searching elsewhere.  Basically, I'm reading the files as an open text stream, then binary comparing the strings using the FSO.  I would like to award partial points to hes since his idea prompted me to search further.  I'll be getting in touch with one of the moderators to do that tommorrow.

Thanks Guys

DS
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7030463
OK. Just take care that files are not huge or that code will runs slooooowly.
0
 
LVL 20

Expert Comment

by:hes
ID: 7030473
Glaad to have pointed you to your solution, and as Richie said make sure the files are not that large.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7030613
optionally, i think you could run your DOS FC with Wscript object.
Cheers
0
 
LVL 3

Expert Comment

by:baldrick
ID: 7031994
If the files are particularly large, running FC might be a bit slow - If this becomes a problem you might want to look into implementing a CRC (Cyclic Redundancy Check) which was designed to quickly detect data corruption.

Regards
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7033803
I was thinking: If you are using fso, you could test for datelastmodified property instead of compare them in binary way. I think it is faster.
0
 

Expert Comment

by:PUCK
ID: 7037556
Points reduced to 25 by request and answer accepted.  Have a nice day.  :)

PUCK
CS Moderator
PUCK@experts-exchange.com
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now