%% Cleanup
% removes the files named in the nam files in this directory
% to cleanup (nam files, m files and xls files untouched)
% TO 091127


% Copyright 2009 Theo Olsthoorn, TU-Delft and Waternet, without any warranty
% under free software foundation GNU license version 3 or later


d=dir('*.nam');

for i=1:length(d)
    fid=fopen(d(i).name,'r');
    fgetl(fid); s=fgetl(fid);
    while s~=-1
        s=s(find(s==' ',1,'last')+1:end);
        if exist(s,'file')
            fprintf('Deleting file <<%s>>\n',s);
            delete(s);
        end
        s=fgetl(fid);
    end
    fclose(fid);
end
        
%deleting bat files
delete('*.bat');
%delete('*.nam');
delete('*.mat');
delete('for.*');
delete('*.p00');
delete('*.err');
delete('*.UCN');
delete('*.CNF');
delete('*.MAS');
delete('*.BCF');
delete('*.OBS');



