469,658 Members | 1,855 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,658 developers. It's quick & easy.

File Compare

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
Nov 22 '05 #1
2 3920
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

"RitaG" <Ri***@discussions.microsoft.com> wrote in message
news:FA**********************************@microsof t.com...
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

Nov 22 '05 #2
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

"The Grim Reaper" wrote:
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

"RitaG" <Ri***@discussions.microsoft.com> wrote in message
news:FA**********************************@microsof t.com...
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


Nov 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by RitaG | last post: by
46 posts views Thread by dawn | last post: by
reply views Thread by Sunit Joshi | last post: by
18 posts views Thread by Torben Laursen | last post: by
1 post views Thread by Roy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.