Solved

vbscript and File Compare

Posted on 2002-05-23
11
2,445 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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 …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

762 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

17 Experts available now in Live!

Get 1:1 Help Now