I have written a function compareTGZ
is used to compare two tgz folders. The tgz folders contains the following types of files: - mat files and textual files such as .m
, .ddf
and .txt
.
The function is defined as follows:
function [testStatus, testMessage] = compareTGZ(refTGZFile, newTGZFile)
I want to add a condition to check the files present in refTGZFile
but not in newTGZFile
and vice versa.
if lenOffnames_old > lenOffnames_new || lenOffnames_old < lenOffnames_new
for i=1:lenOffnames_old
% Split the path of fnames_old with delimiter filesep
refTGZParts = strsplit(fnames_old{i}, filesep);
% Split the path of fnames_new with delimiter filesep
newTGZParts = strsplit(fnames_new{i}, filesep);
if(strcmp(refTGZParts{3},newTGZParts{3}))==0;
testStatus = 0;
% Return files in Reference tgz which are not found in Test tgz
fprintf('File %s in Reference tgz is not found in Test tgz\n',refTGZParts{3});
% Return files in Test tgz which are not found in Reference tgz
fprintf('File %s in Test tgz is not found in Reference tgz\n',newTGZParts{3});
end
end
end
When refTGZFile
contains more files than newTGZFile
, I get the correct results. But newTGZFile
contain more files than refTGZFile
, I get an error.
Please can some one advice me on how to solve this bug.