08-15-2013 04:01 PM
I have two folders with the same files. I want to compare the files in folder 1 with the files in folder 2 and see what vi are different. How do I do that? I have the concerns below.
1. The files in folder 1 and the files in folder 2 have identical names. They can't all be in memory for comparison. Is that a valid problem?
2. Can comparison be done on multiple files?
08-15-2013 04:47 PM
The easiest way to compare the two would be to place all of the code into projects and name the projects differently. You will be able to compare the VIs then since their names will include the project scope. You may run into an issue if you are calling shared code that is not in the project. Code that is not in the project with the same name will only load the first instance which is loaded. I am not sure about comparing multiple files. Are you referring to multiple copies of the same VI or simply having the results of multiple compares visiable at the same time?
08-20-2013 09:27 AM
By mutiple files, I meant multiple files in one folder vs. multiple files in another folder. The name of files for two folders are identical.
08-20-2013 09:59 AM
One question, based on your posts:
Are you looking for exactly identical VIs, identical VIs except for revision number (and/or revision comments), or VIs which have the same functionality but could be different internally?
If you want identical ro essentially identical VIs, you could get the size of each VI in the two folders in a simple directory listing of each and those with identical names but very different sizes between folders are obviously different, for a first screen. Those which have the same size down to the kb level (directory) could be examined individually by getting the file "size" properties. Those which have exactly the same size are likely to be identical (but this would have to be tested to be sure).
Cameron
08-23-2013 12:06 AM
The way I solved this problem was, of course, to write a LabVIEW program. My program took, as parameters, two top-level folders, each holding the tree of VIs (in identically-named folders and having identically-named VIs) I wanted to compare. My routine parsed the directory trees, shunted off those files that were unique to the first and second folder, then "only" had to compare identically-named VIs that were common to the two folders.
Well, the native LVCompare wants to compare two VIs with different names. So I simply added the suffix ".tmp" to the end of the filename from the second folder, did the compare, then renamed the file back again. For example, if I'm supposed to compare "Close File.vi" from the first tree to "Close File.vi" from the second tree, I rename the second file "Close File.tmp.vi", do the compare, then rename the file back to "Close File.vi".
08-26-2013 09:27 AM
VI with same functionalities, but could be different internally. The size of the vi are the same, since it could be a minor code change.
08-26-2013 09:30 AM
so your problem will use LVCompare in a loop that loop thought all files in a folder? I was hoping that this is a native function in LabVIEW.
08-26-2013 12:13 PM
@jyang72211 wrote:
VI with same functionalities, but could be different internally. The size of the vi are the same, since it could be a minor code change.
If all you want to do is compare two VIs to see if they are identical or not, that's fairly easy. There would be no problem opening files with identical names (but different paths). This VI tests, first, if the files have the same size, and if they do, it then does a "byte compare" between them simply by reading them and asking if the "arrays of bytes" are the same or different.
08-26-2013 12:24 PM
@jyang72211 wrote:
VI with same functionalities, but could be different internally. The size of the vi are the same, since it could be a minor code change.
Well, in that case the only thing you can do is set up a test scheme for each group and test them. A "minor code change" can often produce a major output change with the right set of inputs.
BTW, I would be surprised if any significant number of VIs with "minor code changes" would be the same size down to the byte level (as you would get by looking at the file size property, not just perusing a directory). The same number of kilobytes (directory listing), sure, but not all the way down.
Cameron