473,657 Members | 2,572 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4116
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***@discussi ons.microsoft.c om> wrote in message
news:FA******** *************** ***********@mic rosoft.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.DXFileC ompare 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***@discussi ons.microsoft.c om> wrote in message
news:FA******** *************** ***********@mic rosoft.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
7952
by: Raseliarison nirinA | last post by:
hi all, i found an unanswered question at http://www.faqts.com/knowledge_base/index.phtml/fid/538 with possible response below. i've tried to send it at faqt.python but can't figure out how to edit the page. so i put it here. i want to kwon if this can convert all wave file. is there other encodage than 8 or 16 bits for .wav files? any bug and comment are welcome --
0
2091
by: SeanR | last post by:
I have a function to copare two files. It will first copy the original file form a different server to a local temp path and then compare that version to a version that has been restored form tape. Once the compare is complete the file that was copied to a temp location needs to be deleted. I am using the method file.copy(sourcePath, tempPath, true) to copy the file and then file.delete(tempPath) to delete the file. On some of the files...
2
1701
by: zjut | last post by:
want to add a string to the file and the file is sort by letter! for examply: the follow file is a big file! ////////////////////// abort black cabbage dog egg fly ////////////////////
2
621
by: RitaG | last post by:
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...
46
2518
by: dawn | last post by:
Hi all, I am now working on a C program under Unix. The requirement for the program is that: A file name is passed to program as a parameter. The program will Find files under a specified directory. The matched file must have the same content with the given file. It does not matter whether the filenames are the same. It is easy to find file that has the same name with given file, but may be hard to find the files that with the same...
0
301
by: Sunit Joshi | last post by:
Hello All I'm trying to figure out how to do this the best way. Basically, I need to compare DateTime of files across TimeZones. The situation is like this: 1. I have a database say in Korea in which file-1 resides (in OS) and I have stored the UTC of the file's modified time in the database. 2. Next I create a zip archive and send the file to US, where it's
18
1923
by: Torben Laursen | last post by:
Hi Can anyone tell me what is the short-cut to switch between a .h and .cpp file, thanks Torben Laursen ---
1
1835
by: Roy | last post by:
Hello, As a part of my application,I need to compare files generated everyday.I need not need to compare the file contents.I just need to compare the file size,the line count.The files are named in the format,Hyyyymmdd,H denoting History. At present,I use the Dir function to search for the physical existence of the file and I use the debug.print for functions such as filelen(path),GetAttr() etc. My question is how would I put this as a...
8
2593
by: Perl Beginner | last post by:
I am new to Perl and new to this site. I have the same question that I keep seeing, but not finding an answer…why doesn’t the compare function work? I’ve been going at this for a while. My code is (I’m using ActviePerl 5.8.8 Build 822 on Microsoft WinXP): use File::Compare; if (compare("$file1" , "$file") == 0) { print REPORT_FILE "Pass - Files are the same\n"; } else {print REPORT_FILE "Fail - Files are different\n"};
3
5079
by: blunt | last post by:
right the program is nearly complete just a couple of little tweaks and i should have it. The purpose of this program is to write config files for colubrius wireless access points but it's falling over in this section of code: while(line!=32){ fgets(c, 1, sourceFile); strncpy (compare,c,1); if (compare=='\n'){ line++; } }
0
8425
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8326
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8743
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7355
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5647
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2745
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1973
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1736
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.