forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


file compair , perhaps a dll??

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
harry
Contributor
Contributor


Joined: 01 May 2003
Posts: 61

PostPosted: Thu Oct 18, 2007 10:13 pm    Post subject: file compair , perhaps a dll?? Reply with quote

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
View user's profile Send private message
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Fri Oct 19, 2007 9:59 am    Post subject: Reply with quote

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
View user's profile Send private message
harry
Contributor
Contributor


Joined: 01 May 2003
Posts: 61

PostPosted: Fri Oct 19, 2007 2:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group