File Compare

G

Guest

Hi.

In a VB.Net program I use File.Copy to copy some zipped (and text) files
from one server to another. I'm required by management to do a file compare
after the copy has completed.
Is the File.Copy sufficient and it will error out if there's a problem or do
I need to do a file compare to make sure nothing went wrong in the copy?

If I do need to do a file comapre I was thinking about shelling out and
running a bat file to use the Dos "FC" and pipe the results to a file which I
can then search for "no differences found".

This seems to be a clumsy way and I'm thinking there must be something more
efficient out there.

Thanks,
Rita
 
T

The Grim Reaper

I've never used the FC command before, but after a very quick look, I can
tell you it won't do a compare on binary/zipped files.
If it's just text files, then yes, it's suitable. However, IMO I think it's
a clumsy way as well.
One step up from using FC is to use WinDiff or similar.. but again clumsy.
Personally, if you just want to check that the file was copied OK, and IF
there are any differences (i.e. not what they are) then you can use many
properties of the file as check items. For instance, the file size,
revision (if it's an exe), date last modifed, date created, etc.

To answer your question about File.Copy being sufficient... I believe there
are enough fail-safe routines in Windows itself to copy the file correctly -
if it's not a good copy, you'll get some sort of exception or other error.

HTH
__________________________________________
The Grim Reaper
 
G

Guest

Thanks for the response which helped a lot :)

I landed up using the Stamina.DXFileCompare method.
Since this didn't work in VB.Net I created a wrapper VB6 function for it.

It's good to know though that the File.Copy is robust enough to return an
error if the file didn't copy over correctly.

BTW, I couldn't use the file attribute filesize since that's what got us
into trouble in the first place. After a file copy (I don't know what method
was used for the copying - it was done by another department) the copied file
showed the same size as the original one when in fact it was missing rows
from the end of the file.

Rita
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top