Solved

vbscript and File Compare

Posted on 2002-05-23
11
2,456 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +3
11 Comments
 
LVL 9

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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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
 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…

730 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