Link to home
Start Free TrialLog in
Avatar of dds110
dds110

asked on

vbscript and File Compare

Remember the old dos command FC?

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

Thanks
Avatar of Nitin Sontakke
Nitin Sontakke
Flag of India image

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.
ASKER CERTIFIED SOLUTION
Avatar of hes
hes
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Do you need to know if they are changed?
Avatar of dds110
dds110

ASKER

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.  
Avatar of dds110

ASKER

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
OK. Just take care that files are not huge or that code will runs slooooowly.
Glaad to have pointed you to your solution, and as Richie said make sure the files are not that large.
optionally, i think you could run your DOS FC with Wscript object.
Cheers
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
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.
Points reduced to 25 by request and answer accepted.  Have a nice day.  :)

PUCK
CS Moderator
PUCK@experts-exchange.com