Page 1 of 1 1
Topic Options
#72316 - 2002-12-23 01:49 PM file comparison
Raceeend Offline
Starting to like KiXtart

Registered: 2002-05-09
Posts: 129
Loc: The Netherlands
Hello,

I want to make a scripts that can compare files in a directory (including subdir's). When two files are the same it has to write both file locations and file sizes into a log file.

Any idea how to handle this?
_________________________
regards, Martijn

Top
#72317 - 2002-12-23 03:21 PM Re: file comparison
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Please use the KiXtart BBS Search as these topics have been discussed numerous times.

Potential solution:
Enumerate files in first directory with any of the DIR UDFs that are posted in the UDF Forum.
Check whether an identical file exists in the second directory. Finally, if there's an identical file, wirte into log file with WRITELINE
code:
;pseudecode (non-working, for illustration purposes only)
$filelist=dirplus('c:\temp\*.*')
for each $file in $filelist
$newfilelist=dirplus('d:\temp\'+$file)
if $newfilelist
; write log file
endif
next



[ 23. December 2002, 15:42: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#72318 - 2002-12-23 03:27 PM Re: file comparison
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Martijn,
You may want to better phrase your question. The way I interpret what you say, you want to compare each file in a given folder with every other file in the same folder as well as sub folders. If that is the case you have a lot of recursion to do.

You should probably elaborate.

[ 23. December 2002, 15:28: Message edited by: LLigetfa ]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#72319 - 2002-12-23 04:57 PM Re: file comparison
Raceeend Offline
Starting to like KiXtart

Registered: 2002-05-09
Posts: 129
Loc: The Netherlands
Les,

That's exactly what i want to do.
_________________________
regards, Martijn

Top
#72320 - 2002-12-23 05:05 PM Re: file comparison
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
What condition(s) determines that the
quote:
...two files are the same...
?
name, size, date, content, attributes, etc. ???

[ 23. December 2002, 17:07: Message edited by: Waltz ]
_________________________
We all live in a Yellow Subroutine...

Top
#72321 - 2002-12-24 10:27 AM Re: file comparison
Raceeend Offline
Starting to like KiXtart

Registered: 2002-05-09
Posts: 129
Loc: The Netherlands
Well i guess size is the most accurate one.
But a combination of size and name would be great.
_________________________
regards, Martijn

Top
#72322 - 2002-12-24 02:39 PM Re: file comparison
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Martijn,
That doesn't make sense. If you are going to compare files in the same dir then they obviously can't have the same name. Contrary topopular opinion, size doesn't matter either. Files can be the same size but different.

The only way to be sure is to use a full compare like FC.EXE or the like.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#72323 - 2002-12-25 12:59 AM Re: file comparison
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
If I may Les,

I think he means he wants a script to look for DUPLICATE files and then write it to a log file. Example WIDGET.EXE may be in 5 or more different directories, and he wants to log all of them.

Not sure why he wants to use KiXtart to do it with though, as there are numerous programs out there that will already do that much quicker then KiXtart can. However, if he is wanting to do it as a LEARNING experience to better his skills at KiXtart... then hey what the heck. [Wink]

[ 25. December 2002, 01:01: Message edited by: NTDOC ]

Top
#72324 - 2002-12-25 01:39 AM Re: file comparison
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
DOC,
That is why I asked for clarification.
quote:
compare each file in a given folder with every other file in the same folder
His reply was:
quote:
That's exactly what i want to do
[Frown]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#72325 - 2002-12-28 10:43 PM Re: file comparison
Raceeend Offline
Starting to like KiXtart

Registered: 2002-05-09
Posts: 129
Loc: The Netherlands
Les,

Sorry for the wrong answer i gave you but what NTDOC said in his last post is what i really want to do.

I want to check if there are file more then ones in our department/home folders. Just to see how much diskspace there could be saved if people cleared their mess more often.

NTDOC,

wich programs are you talking about?
_________________________
regards, Martijn

Top
#72326 - 2002-12-29 03:22 AM Re: file comparison
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Martijn,

So are you looking to see:
  • File names
  • Quantity of files
  • Size of files
  • Differences
  • Similarities
??
Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#72327 - 2002-12-29 03:01 PM Re: file comparison
Raceeend Offline
Starting to like KiXtart

Registered: 2002-05-09
Posts: 129
Loc: The Netherlands
Kent,

I want to see how many duplicate files there are and what sizes they have. So that i can make a report to how much drivespace is taken by useless data.
_________________________
regards, Martijn

Top
#72328 - 2002-12-30 02:28 PM Re: file comparison
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Probably the easiest way to address the duplicates is to write these folders out to a text file and run it through MS-Access "find duplicates wizard" in the query builder.

Under NT, you would do something like -

DIR E: /B /S > C:\DRVLOG.TXT

Then you could link or import this file..

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 699 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.06 seconds in which 0.022 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org