Automating file comparison; different directory structures
Posted: Fri Mar 22, 2013 6:21 am
The problem: I have a large number of source and target files to compare. The files to compare have the same name, but the source and target directories have different hierarchies; e.g. source/2003/alpha/v2/foo.txt vs. target/versions/2/A03/foo.txt. For each file I would like to generate output such as:
foo.txt: 3 lines deleted, 12 lines added, 9 lines changed, 127 lines unchanged.
Using ExamDiff Pro 6.0, I think I must use following method to accomplish this:
- Write a script that for each file in the source, finds the file in the target
- For each such file pair, use the command-line ExamDiff.exe to output the differences between each file
- Parse the output (which looks a lot like standard diff) to determine the number of deleted, added, and changed lines
- On the basis of the above, and the number of lines in the source and target file, determine the number of unchanged lines as well
- Merge each file result into a single report.
At first glance, it would seem just as easy to use standard "diff" to generate the results in the above procedure. Does ExamDiff Pro add any value to this process? Am I missing an EDP feature that would make this task easier?
Thanks very much.
foo.txt: 3 lines deleted, 12 lines added, 9 lines changed, 127 lines unchanged.
Using ExamDiff Pro 6.0, I think I must use following method to accomplish this:
- Write a script that for each file in the source, finds the file in the target
- For each such file pair, use the command-line ExamDiff.exe to output the differences between each file
- Parse the output (which looks a lot like standard diff) to determine the number of deleted, added, and changed lines
- On the basis of the above, and the number of lines in the source and target file, determine the number of unchanged lines as well
- Merge each file result into a single report.
At first glance, it would seem just as easy to use standard "diff" to generate the results in the above procedure. Does ExamDiff Pro add any value to this process? Am I missing an EDP feature that would make this task easier?
Thanks very much.