Hi Reeza, Thanks again, but this is too generic for a very specific issue. I've found the solution fortunately. Filling in the 3 parameters below does the trick. At first it didn't work because I put the extension between quotes............. Rgds B %let ext = EGP; %let namezip = test.zip; %let zippath = c:\temp; %macro checkzipexistsdel (zipfile); %if %sysfunc(fileexist(&zipfile.)) %then %do; x del "&zipfile."; %end; %else %do ; %put : Does not exist; %end; %mend; %checkzipexistsdel (&zippath.\&namezip.); %let n=0; %macro readCatalog(path, localpath); %local rc _path filrf did noe filename fid i; %if %superq(localpath) = %then %let _path=%superq(path); %else %let _path=%superq(path)\%superq(localpath); %let n=%eval(&n+1); %let filrf=DIR&n; %let rc = %sysfunc(filename(filrf, %superq(_path))); %let did = %sysfunc(dopen(&filrf)); %let noe = %sysfunc(dnum(&did)); %do i = 1 %to &noe; %let filename = %bquote(%sysfunc(dread(&did, &i))); %let fid = %sysfunc(mopen(&did, &filename)); %if &fid > 0 %then %do; %put &=path &=localpath &=_path &=filename; /*Run the zip process for a specific extension*/ %if %sysfunc(strip(%scan(%upcase(%superq(filename)),-1, '.'))) = &ext. %then %do; ods package(newzip) add file="%superq(_path)\%superq(filename)" path="%superq(localpath)"; %put DE FILE IS %superq(filename); %end; %end; %else %do; %if %superq(localpath) = %then %readCatalog(%superq(path), %superq(filename)); %else %readCatalog(%superq(path), %superq(localpath)\%superq(filename)); %end; %end; %let rc=%sysfunc(dclose(&did)); %mend readCatalog; %macro createZIP(path, archive_name, archive_path); %put *** Creating an archive (&archive_path\&archive_name) ***; ods package(newzip) open nopf; %readCatalog(&path) ods package(newzip) publish archive properties( archive_name="&archive_name" archive_path="&archive_path" ); ods package(newzip) close; %mend createZIP; %createZIP(&zippath., &namezip., &zippath.);
... View more