WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Functions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Comparing File Times and Sizes

Keywords:     filecompare FileTimeGet filesize	 FileTimeCode

Question:

I am using filecompare function to compare a large number of files. Most of them are identical but filecompare needs to find the few that are different. I read in the manual that filecompare only does a byte by byte check when the file are the same size and date. If this is true this is a waste of time for my program. Going by size and date is good enough. Is there a way to turn off the byte checking?

Answer:

Instead of using the FileCompare function, just use the FileSize and FileTimeGet functions to get the file sizes and dates yourself and compare those.

FileTimeCode gets a machine readable version of FileTime.

FileCompare, on the other hand first checks file sizes. If the Filesizes are equal then it will do a byte by byte compare. If the contents are the same, FileCompare will return 0, regardless of the dates. The other codes indicate that the contents are different.

If the filesizes being same and filetimes being the same is good enough for you, you could...

	fn1="x:\xxx.txt"
	fn2="y:\yyy.txt"

	different=@FALSE
	if FileTimeCode(fn1)!=FileTimeCode(f2) then different=@TRUE
	if FileSize(fn1)!=FileSize(fn2) then different=@TRUE
but that does not actually compare data.

FileCompare Failing Over Network from one PC

Question:

Basically all I am doing is doing a filecompare on INHOUSE.EXE and FOXTOOLS.FLL from the network to the local drive. If they don't match, I am copying the network file to the local C:\tt directory. Then I run INHOUSE.EXE.

The problem is it still copies the files every time from this one PC (but not mine) even though they are the same. There is no virus software running.

This guy on one particular PC has been having trouble for weeks. I even reformatted his laptop. It is a SONY PCG-735. I have the same exact laptop and I don't have any problems. It seems as if something is not getting cleared in memory.

Answer:

Something is going wrong.

Copy the real copy from the network to your own CP, and copy the files from the failing laptop and compare the files on your own PC to see if your PC thinks they are different or not

I'm kind of beginning to think the failing PC is sick.

Half the time its a network card in cases like this.

Resolution:

We put a 3Com network card in it and now it works great. The FILECOMPARE works and no more strange errors. We did have a Linksys 10/100 (PCMIA) in it.

Thanks for pointing us in the right direction!!!!!


Article ID:   W13060
Filename:   FileCompare - FileSize - FileTimeCode.txt
File Created: 1999:08:11:16:08:56
Last Updated: 1999:08:11:16:08:56