Help using Base SAS procedures

Zip question

Accepted Solution Solved
Reply
N/A
Posts: 1
Accepted Solution

Zip question

I have been having a few problems with my code and while I finally corrected one problem, it seems to have created another one. Background: my coworker is out on leave, and I have inherited some of his code. The original problem was: when my coworker ran a job in his crontab or when I ran it manually, it worked fine when the zip command just had the filename. But when I run it through MY crontab, after it created an excel file it would fail when trying to email the zip because no zip was created. Once I changed the code to have the full path and not just the filename it is emailing the zip successfully, but it causes my zip file to be full of folders of the full path. I.E. path is /proj/team/MIS/Daily/job1 and when I get the email and open the zip file it opens a proj folder, inside that is a team folder, inside that is a MIS folder...etc until it finally gets to the xls. I just want the xls to be in the zip, no folders.

Here is the code I am using to create the zip.

DATA _NULL_;

  CALL SYMPUT("sysdate2",PUT(TODAY(),YYMMDDn8.));

RUN;

DATA _NULL_;

  CALL SYSTEM("/usr/bin/zip -9 /proj/team/MIS/Daily/job1/job1_&sysdate2 /proj/team/MIS/Daily/job1/job1_&sysdate2..xls");

  X=SLEEP(5,1);

RUN;

Does anyone know how I can fix this?


Accepted Solutions
Solution
‎11-13-2013 07:47 PM
Respected Advisor
Posts: 3,893

Re: Zip question

I believe this is just about adding a switch to your zip command so that the folder structure doesn't get included. You will need to consult the man pages for your zip implementation to determine the correct syntax (it could be -j: "/usr/bin/zip -9 -j /proj/team......)

View solution in original post


All Replies
Solution
‎11-13-2013 07:47 PM
Respected Advisor
Posts: 3,893

Re: Zip question

I believe this is just about adding a switch to your zip command so that the folder structure doesn't get included. You will need to consult the man pages for your zip implementation to determine the correct syntax (it could be -j: "/usr/bin/zip -9 -j /proj/team......)

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 151 views
  • 0 likes
  • 2 in conversation