


todir = '/Volumes/platforms/pack_ice/ice_ps/visss_cub/exdata/PS122-1_1-243/slave/mosaic/data/visss2_visss_slave_S1143155/2020/';
fromdir = '/Volumes/LIME_4/slave/visss2_visss_slave_S1143155/data/2020/';

mo = 2:3;
dd = 1:31;
tic
for m = 1:length(mo)
    for d = 1:length(dd)
        mostr = num2str(mo(m)); if length(mostr) == 1; mostr = ['0',mostr]; end
        dstr = num2str(dd(d)); if length(dstr) == 1; dstr = ['0',dstr]; end
        
        if exist([fromdir,mostr,'/',dstr]) > 0 && exist([todir,mostr,'/',dstr,'.tar']) == 0
            disp(['compressing file, ',todir,mostr,'/',dstr,'.tar at ',num2str(round(toc*10)/10),'sec.']);
            unix(['tar -czf ',todir,mostr,'/',dstr,'.tar ',fromdir,mostr,'/',dstr]);
        end
    end
end
        

