I need somebody to help me finding the better way to achieve my goal.
I need to identify (and then often delete or move) files that are "smaller/previous versions", this happens with log files that grow in time.
Example:
fileA:
Line1
Line2
fileB:
Line1
Line2
Line3
fileC:
Line1
Line2
Line3
Line4
I want to detect that fileA and fileB are "included" at the start of the text of fileC, so I can safely remove them.
My idea was to write a comparison function that returns:
0 when the files are equal in size and content (like find duplicates)
1 when at least a byte is different
2 when all bytes are equal but first file is bigger
3 when all bytes are equal but second file is bigger
How could I get to the point?
It would be enough for me to obtain a list of the files with the 0-3 values to manage with a batch file.
Find duplicates search comparison plugin
Moderators: Hacker, petermad, Stefan2, white
-
- Junior Member
- Posts: 91
- Joined: 2006-11-07, 16:36 UTC
- Location: Trieste, Italy
- Contact:
-
- Junior Member
- Posts: 91
- Joined: 2006-11-07, 16:36 UTC
- Location: Trieste, Italy
- Contact:
I was able to write a WDX "content plugin" using the .NET wrapper, and I will try to use the method:
ContentCompareResult CompareFiles()
to compare the two log files and report the result.
Is the "ContentCompareResult" enum documented anywhere? I'm not getting the difference between:
return ContentCompareResult.EqualWithTxt;
return ContentCompareResult.EqualWithIcon;
Any help?
ContentCompareResult CompareFiles()
to compare the two log files and report the result.
Is the "ContentCompareResult" enum documented anywhere? I'm not getting the difference between:
return ContentCompareResult.EqualWithTxt;
return ContentCompareResult.EqualWithIcon;
Any help?
-
- Junior Member
- Posts: 91
- Joined: 2006-11-07, 16:36 UTC
- Location: Trieste, Italy
- Contact:
Anyway, the WDX does not solve the original problem, as I can't use the CompareFiles() as an input for the "same plugin fields" in the "find duplicates" function, that seems to be hardcoded in TC.
Would you suggest to write a standalone program or have you any other idea to use TC to at least provide the combinations of comparisons to do for the given search? Even if it will not show the files in TC as a result.
Would you suggest to write a standalone program or have you any other idea to use TC to at least provide the combinations of comparisons to do for the given search? Even if it will not show the files in TC as a result.
-
- Junior Member
- Posts: 91
- Joined: 2006-11-07, 16:36 UTC
- Location: Trieste, Italy
- Contact:
Conclusion I did both:
WDX content plugin:
when synchronizing gives out files equal, not equal and
left file is included in rigth file: EqualWithTxt
right file is included in left file: EqualWithIcon
--> the two icons appear equal, how should this be managed?
exe program:
recurses all directories passed as arguments
compares each file with all others line by line
return a number N followed by the two compared files, semicolon separated
N=0 means the files are equal
N=1 (optional) files are not equal
N=2 first file is included in second file
N=3 second file is included in first file
with this output it is easy to prepare a batch file to move or delete desired "duplicate" files
WDX content plugin:
when synchronizing gives out files equal, not equal and
left file is included in rigth file: EqualWithTxt
right file is included in left file: EqualWithIcon
--> the two icons appear equal, how should this be managed?
exe program:
recurses all directories passed as arguments
compares each file with all others line by line
return a number N followed by the two compared files, semicolon separated
N=0 means the files are equal
N=1 (optional) files are not equal
N=2 first file is included in second file
N=3 second file is included in first file
with this output it is easy to prepare a batch file to move or delete desired "duplicate" files