| View previous topic :: View next topic |
| Author |
Message |
harry Contributor


Joined: 01 May 2003 Posts: 61
|
Posted: Thu Oct 18, 2007 10:13 pm Post subject: file compair , perhaps a dll?? |
|
|
ok so on to the next problem..
i want to compair the contents of some files so there is no dups,
the file names may be different but the contents are the same
so is there a dll(freeware) that might compair whole files or must it be done some other way?
perhaps do a filesize and then compair the sizes and then take a line
and and compair?
thanks for any input |
|
| Back to top |
|
 |
DaveR Valued Contributor


Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Fri Oct 19, 2007 9:59 am Post subject: |
|
|
You could do a MD5 hash of each file and compare that.
http://www.fourmilab.ch/md5/
| Code: | # Create MD5 file
directory change,%%Path
runh @chr(34)@path(%0)md5.exe@chr(34) @chr(34)%%FileName.%%FileExt@chr(34) ,pipe
if @ok()
%p = @pipe()
end
if @not(@null(%p))
binfile open,1,%%Path\%%FileName.md5,create
binfile write,1,text,%p@cr()@lf()
binfile close,1
%p = ""
end
|
_________________ cheers
Dave |
|
| Back to top |
|
 |
harry Contributor


Joined: 01 May 2003 Posts: 61
|
Posted: Fri Oct 19, 2007 2:52 pm Post subject: |
|
|
here's what i hacked up, works so far
(vds4)
| Code: | EXTERNAL string.DLL
list create,1
list create,2
list create,3,sorted
list filelist,3,c:\windows\desktop\alerts\*.txt,
list seek,3,0
rem the file you are going to put in dir
rem check to see if there's a match
%%file1 = c:\windows\desktop\alerts\ALERT10.17.07--1.51.58pm.txt
list loadfile,1,%%file1
%%listcount = @count(3)
repeat
%%listcount = @pred(%%listcount)
%%file2 = @next(3)
rem info 1 %%file1 %%file2
list loadfile,2,%%file2
if @null(@string(Equal,@text(1),@text(2)))
info nope no match
else
info they match @cr()%%file1 @cr()%%file2
if @query(delete?)
file delete,%%file2,
end
end
until @equal(%%listcount,1)
list close,1
list close,2
list close,3 |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|