<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: filename zip pipe wrong target path is used in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441395#M110420</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Just managed to find solution below. The -p parameter did work though, Dave &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks everybody&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;x "cd c:\temp\test";&lt;BR /&gt;filename zip pipe "zip -r -p split.zip * " ;&lt;BR /&gt;data _null_;&lt;BR /&gt;infile zip;&lt;BR /&gt;input;&lt;BR /&gt;put _infile_;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;B&lt;/P&gt;</description>
    <pubDate>Thu, 01 Mar 2018 21:48:14 GMT</pubDate>
    <dc:creator>Billybob73</dc:creator>
    <dc:date>2018-03-01T21:48:14Z</dc:date>
    <item>
      <title>filename zip pipe wrong target path is used</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441224#M110339</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I'm not sure if anyone has ever worked with this or if this is the right place to ask this question since it is not really a SAS topic.. but i'll give it a try anyway.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm running this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;filename zip pipe "zip -r c:\temp\accept\test.zip c:\temp\accept/*" ;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;data _null_;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;infile zip;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;input;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;put _infile_;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;run;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And this is working.........&lt;/P&gt;&lt;P&gt;But when I doubleclick on test.zip it appears that the contents of the zip files is in this path :&lt;/P&gt;&lt;P&gt;c:\temp\accept\test.zip\temp\accept&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is not what I want.&lt;/P&gt;&lt;P&gt;It&amp;nbsp; needs to go in&amp;nbsp; :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;c:\temp\accept\test.zip&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I change this 'Windows command' to make sure this will happen ?&lt;/P&gt;&lt;P&gt;I've checked the Info-Zip FAQ but cannot find out what to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;B&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="1"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 15:37:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441224#M110339</guid>
      <dc:creator>Billybob73</dc:creator>
      <dc:date>2018-03-01T15:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: filename zip pipe wrong target path is used</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441239#M110348</link>
      <description>&lt;P&gt;Yes, thats more of a question for the zip command line people.&amp;nbsp; A check on the documents reveals this:&lt;/P&gt;
&lt;TABLE border="0" width="100%" frame="void" rules="none" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR align="left" valign="top"&gt;
&lt;TD width="2%"&gt;
&lt;P&gt;&lt;STRONG&gt;-p&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="85%"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;TABLE border="0" width="100%" frame="void" rules="none" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR align="left" valign="top"&gt;
&lt;TD width="10%"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="89%"&gt;
&lt;P&gt;&lt;STRONG&gt;--paths&lt;/STRONG&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;TABLE border="0" width="100%" frame="void" rules="none" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR align="left" valign="top"&gt;
&lt;TD width="21%"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="77%"&gt;
&lt;P&gt;Include relative file paths as part of the names of files stored in the archive. This is the default. The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;-j&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;option junks the paths and just stores the names of the files.&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.info-zip.org/mans/zip.html" target="_blank"&gt;http://www.info-zip.org/mans/zip.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 15:58:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441239#M110348</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-03-01T15:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: filename zip pipe wrong target path is used</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441330#M110387</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks. -j works, however this only compresses root folder contents. I need to compress the whole directory structure including files within folders, hence the use of -r in my script. I tried to use both , but this does not work unfortunately.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this structure possible at all ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;zip -j -r foo foo/*&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in which foo is the directory path&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;B&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 18:54:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441330#M110387</guid>
      <dc:creator>Billybob73</dc:creator>
      <dc:date>2018-03-01T18:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: filename zip pipe wrong target path is used</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441333#M110388</link>
      <description>&lt;P&gt;If you don't want the high level folders in the paths that are included in the ZIP file then don't use them in the command.&lt;/P&gt;
&lt;P&gt;So instead of&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename zip pipe "zip -r c:\temp\accept\test.zip c:\temp\accept/*" ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You want something more like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename zip pipe "cd c:\temp\accept; zip -r test.zip *" ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But you might want to write the ZIP file itself to another folder&amp;nbsp;to prevent it from&amp;nbsp;trying to store a copy of the zip file inside itself.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename zip pipe "cd c:\temp\accept; zip -r ..\test.zip *" ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 19:01:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441333#M110388</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-03-01T19:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: filename zip pipe wrong target path is used</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441344#M110393</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;Thanks for your suggestion. This sounds very logical, except it doesn't do anything, no zipfiles unfortunately.&lt;/P&gt;&lt;P&gt;Something still is wrong in the syntax.. I tried them with a forward slash right before the *, but no success either..&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;B&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;filename zip pipe "cd c:\temp\accept; zip -r test.zip *" ;&lt;/P&gt;&lt;P&gt;filename zip pipe "cd c:\temp\accept; zip -r c:\temp\accept\test.zip *" ;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 19:33:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441344#M110393</guid>
      <dc:creator>Billybob73</dc:creator>
      <dc:date>2018-03-01T19:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: filename zip pipe wrong target path is used</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441357#M110398</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/172904"&gt;@Billybob73&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi Tom,&lt;/P&gt;
&lt;P&gt;Thanks for your suggestion. This sounds very logical, except it doesn't do anything, no zipfiles unfortunately.&lt;/P&gt;
&lt;P&gt;Something still is wrong in the syntax.. I tried them with a forward slash right before the *, but no success either..&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;B&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;filename zip pipe "cd c:\temp\accept; zip -r test.zip *" ;&lt;/P&gt;
&lt;P&gt;filename zip pipe "cd c:\temp\accept; zip -r c:\temp\accept\test.zip *" ;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Get the commands to work from command window then use them.&lt;/P&gt;
&lt;P&gt;You might need to use an X command to run the CD command separately.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also I find it useful to use a data _null_ step with piped command do see what messages the command is generating.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile 'some command' pipe ;
  input;
  put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There might be more advanced ZIP options that allow for you to specify what part of path to include in zip file.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 20:22:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441357#M110398</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-03-01T20:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: filename zip pipe wrong target path is used</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441373#M110403</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm sorry but I just do not know how to do this . Also this failed...........&lt;/P&gt;&lt;P&gt;Anyone happens to have this code ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;x "c:\temp\accept";&lt;BR /&gt;filename zip pipe "zip -r test.zip" ;&lt;BR /&gt;data _null_;&lt;BR /&gt;infile zip;&lt;BR /&gt;input;&lt;BR /&gt;put _infile_;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;B&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 20:53:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441373#M110403</guid>
      <dc:creator>Billybob73</dc:creator>
      <dc:date>2018-03-01T20:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: filename zip pipe wrong target path is used</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441376#M110406</link>
      <description>&lt;P&gt;You may need to add the -p (or -P) command line option to store the folder names.&amp;nbsp; From the doc:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;WZZIP reference&lt;/P&gt;
&lt;TABLE cellspacing="0" cellpadding="5"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD valign="top"&gt;&lt;A name="p_z" target="_blank"&gt;&lt;/A&gt;&lt;STRONG&gt;-p|P&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD&gt;Store folder names. A lower case &lt;STRONG&gt;p&lt;/STRONG&gt; stores only the names of folders recursed (subfolders included) via the &lt;STRONG&gt;-r&lt;/STRONG&gt; option, while an upper case &lt;STRONG&gt;P&lt;/STRONG&gt; stores all folder information specified on the command line or in the listfile. &lt;STRONG&gt;Use with the -r option.&lt;/STRONG&gt;
&lt;P&gt;In the following examples, assume this folder structure:&lt;/P&gt;
&lt;PRE class="Ex"&gt;  Level1\LevelA&lt;BR /&gt;  Level1\LevelB&lt;/PRE&gt;
&lt;P&gt;Level1 contains the file file1.txt&lt;/P&gt;
&lt;P&gt;Level1\LevelA contains two files, a1.txt and a2.txt&lt;/P&gt;
&lt;P&gt;Level1\LevelB contains two files, b1.txt and b2.txt&lt;/P&gt;
&lt;PRE class="Ex"&gt;  wzzip -p -r d:\temp\test.zip d:\level1\*.*&lt;/PRE&gt;
&lt;P&gt;This creates test.zip containing file1.txt, folder Level1\LevelA with files a1.txt and a2.txt, and folder Level1\LevelB with files b1.txt and b2.txt. Note that the folder Level1 itself does not get included.&lt;/P&gt;
&lt;P&gt;Extracting from test.zip will create the following files and folders in the extract-to folder:&lt;/P&gt;
&lt;P&gt;File1.txt&lt;/P&gt;
&lt;P&gt;LevelA\a1.txt&lt;/P&gt;
&lt;P&gt;LevelA\a2.txt&lt;/P&gt;
&lt;P&gt;LevelB\b1.txt&lt;/P&gt;
&lt;P&gt;LevelB\b2.txt&lt;/P&gt;
&lt;PRE class="Ex"&gt;  wzzip -P -r d:\temp\test.zip d:\level1\*.*&lt;/PRE&gt;
&lt;P&gt;This creates test.zip with folder Level1 containing file file1.txt, folder Level1\LevelA containing files a1.txt and a2.txt, and folder Level1\LevelB containing files b1.txt and b2.txt.&lt;/P&gt;
&lt;P&gt;Extracting from test.zip will create the following files and folders in the extract-to folder:&lt;/P&gt;
&lt;P&gt;Level1\file1.txt&lt;/P&gt;
&lt;P&gt;Level1\LevelA\a1.txt&lt;/P&gt;
&lt;P&gt;Level1\LevelA\a2.txt&lt;/P&gt;
&lt;P&gt;Level1\LevelB\b1.txt&lt;/P&gt;
&lt;P&gt;Level1\LevelB\b2.txt&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Thu, 01 Mar 2018 21:05:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441376#M110406</guid>
      <dc:creator>DaveHorne</dc:creator>
      <dc:date>2018-03-01T21:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: filename zip pipe wrong target path is used</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441384#M110412</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks Dave.&lt;/P&gt;&lt;P&gt;I tried to add the -p but nothing happens unfortunately.&lt;/P&gt;&lt;P&gt;x "c:\temp\test";&lt;BR /&gt;filename zip pipe "zip -p -r test.zip" ;&lt;BR /&gt;data _null_;&lt;BR /&gt;infile zip;&lt;BR /&gt;input;&lt;BR /&gt;put _infile_;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is wzzip&amp;nbsp; ? I'm using the zip and unzip commands from Info-Zip.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;B&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 21:18:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441384#M110412</guid>
      <dc:creator>Billybob73</dc:creator>
      <dc:date>2018-03-01T21:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: filename zip pipe wrong target path is used</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441392#M110419</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/172904"&gt;@Billybob73&lt;/a&gt;&amp;nbsp;sorry about that, I was thinking WinZip, which has separate CLI tools, and I see now you are using Info-Zip.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 21:41:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441392#M110419</guid>
      <dc:creator>DaveHorne</dc:creator>
      <dc:date>2018-03-01T21:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: filename zip pipe wrong target path is used</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441395#M110420</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Just managed to find solution below. The -p parameter did work though, Dave &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks everybody&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;x "cd c:\temp\test";&lt;BR /&gt;filename zip pipe "zip -r -p split.zip * " ;&lt;BR /&gt;data _null_;&lt;BR /&gt;infile zip;&lt;BR /&gt;input;&lt;BR /&gt;put _infile_;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;B&lt;/P&gt;</description>
      <pubDate>Thu, 01 Mar 2018 21:48:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filename-zip-pipe-wrong-target-path-is-used/m-p/441395#M110420</guid>
      <dc:creator>Billybob73</dc:creator>
      <dc:date>2018-03-01T21:48:14Z</dc:date>
    </item>
  </channel>
</rss>

