<?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: Why does tar not work? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241405#M891276</link>
    <description>I just checked on a Linux system.If you have many files, only the files found 'last' will be in the archive.So you may want to use an 'append' or 'update' mode. Linux tar has an 'r' flag, for append mode.This gave a weird result: the tar arhive contained twice as many files as were found by find. I do not understand (yet).So, using xargs causes the problem.My suggestion to use find ... | tar cvf is wrong. Won't work.JP</description>
    <pubDate>Tue, 06 Apr 2004 13:02:16 GMT</pubDate>
    <dc:creator>Jeroen Peereboom</dc:creator>
    <dc:date>2004-04-06T13:02:16Z</dc:date>
    <item>
      <title>Why does tar not work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241389#M891260</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I need to create a tar archive using a combination of find, xargs, and tar. E.g.&lt;BR /&gt;&lt;BR /&gt;find tmp | xargs tar fcv tmp.tar&lt;BR /&gt;&lt;BR /&gt;(Assume some more options of find for filtering purposes.)&lt;BR /&gt;&lt;BR /&gt;find produces an output of several hundred paths. All these files shall be put into one tar archive "tmp.tar". But this does not work. Although, I do not get an error message, the resulting tar archive never reflects the paths delivered by the find process.&lt;BR /&gt;&lt;BR /&gt;I tried some other variants:&lt;BR /&gt;&lt;BR /&gt;% tar fc tmp.tar `find tmp`&lt;BR /&gt;&lt;BR /&gt;% tar fc tmp.tar any_file&lt;BR /&gt;% find tmp | xargs -n 10 tar fr tmp.tar&lt;BR /&gt;&lt;BR /&gt;% tar fc tmp.tar any_file&lt;BR /&gt;% find tmp -exec tar fr tmp.tar {} \;&lt;BR /&gt;&lt;BR /&gt;Nothing works. What is going wrong? What is the solution?&lt;BR /&gt;&lt;BR /&gt;(Is it time to change from HP-UX 11.00 to Linux?)</description>
      <pubDate>Tue, 06 Apr 2004 10:51:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241389#M891260</guid>
      <dc:creator>Thomas Schler_1</dc:creator>
      <dc:date>2004-04-06T10:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: Why does tar not work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241390#M891261</link>
      <description>No, no need to change to Linux.  You just need to get your command line options in the correct order.&lt;BR /&gt;&lt;BR /&gt;Your 'f' option should immediately preceed the name of the file you are taring t.&lt;BR /&gt;&lt;BR /&gt;# tar -cvf tmp.tar filenames&lt;BR /&gt;&lt;BR /&gt;So in your examples:&lt;BR /&gt;&lt;BR /&gt;# find tmp | xargs tar cvf tmp.tar -&lt;BR /&gt;&lt;BR /&gt;Note the '-' at the end of the tar command as well.  That tells tar to read the file names from standard input.</description>
      <pubDate>Tue, 06 Apr 2004 10:57:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241390#M891261</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2004-04-06T10:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Why does tar not work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241391#M891262</link>
      <description>Is it find tmp | xargs tar fcv tmp.tar&lt;BR /&gt;or find /tmp | xargs tar -fcv tmp.tar&lt;BR /&gt;&lt;BR /&gt;Anil</description>
      <pubDate>Tue, 06 Apr 2004 10:57:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241391#M891262</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2004-04-06T10:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: Why does tar not work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241392#M891263</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;the command works for me. I just ran the command that thomas has mentioned and got a tar file. What is the error you are getting. Hope you are not running out on filesystem space.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;Regds&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Apr 2004 11:04:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241392#M891263</guid>
      <dc:creator>Sanjay_6</dc:creator>
      <dc:date>2004-04-06T11:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why does tar not work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241393#M891264</link>
      <description>Patrick,&lt;BR /&gt;&lt;BR /&gt;unfortunately, there's no effect using '-' or using it not. Again, no error message, but:&lt;BR /&gt;&lt;BR /&gt;% find tmp | xargs tar cvf tmp.tar -&lt;BR /&gt;% find tmp | wc&lt;BR /&gt;336 337 8656&lt;BR /&gt;% tar ft tmp.tar | wc&lt;BR /&gt;35 35 675&lt;BR /&gt;&lt;BR /&gt;(Using xargs, '-' should be obsolete.)&lt;BR /&gt;&lt;BR /&gt;Something is going wrong here. I assume, it has something to do with LINE_MAX, see xargs(1) and limits(5).&lt;BR /&gt;&lt;BR /&gt;But, what is the work-around?</description>
      <pubDate>Tue, 06 Apr 2004 11:09:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241393#M891264</guid>
      <dc:creator>Thomas Schler_1</dc:creator>
      <dc:date>2004-04-06T11:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: Why does tar not work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241394#M891265</link>
      <description>Sanjay,&lt;BR /&gt;&lt;BR /&gt;thank you for your test; no, file space is ok.&lt;BR /&gt;&lt;BR /&gt;Please, see my answer to Patrick. Would you, please, again do the test with some hundreds of files, and, say about, 50 MB?</description>
      <pubDate>Tue, 06 Apr 2004 11:14:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241394#M891265</guid>
      <dc:creator>Thomas Schler_1</dc:creator>
      <dc:date>2004-04-06T11:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: Why does tar not work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241395#M891266</link>
      <description>#find dir | xargs tar cvf dirnam.tar - &lt;BR /&gt;&lt;BR /&gt;works for me here, provided I'm in the correct directory. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Apr 2004 11:15:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241395#M891266</guid>
      <dc:creator>Marvin Strong</dc:creator>
      <dc:date>2004-04-06T11:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: Why does tar not work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241396#M891267</link>
      <description>Marvin,&lt;BR /&gt;&lt;BR /&gt;please, do following test:&lt;BR /&gt;&lt;BR /&gt;% find dir | xargs tar cvf dirnam.tar&lt;BR /&gt;% find dir | wc&lt;BR /&gt;output??&lt;BR /&gt;&lt;BR /&gt;% tar ft dirnam.tar | wc&lt;BR /&gt;output??</description>
      <pubDate>Tue, 06 Apr 2004 11:19:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241396#M891267</guid>
      <dc:creator>Thomas Schler_1</dc:creator>
      <dc:date>2004-04-06T11:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: Why does tar not work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241397#M891268</link>
      <description>&amp;gt; % tar ft dirnam.tar | wc&lt;BR /&gt;&lt;BR /&gt; Again, the 'f' (file) option should come right before the filename:&lt;BR /&gt;&lt;BR /&gt; % tar tf dirnam.tar | wc&lt;BR /&gt;&lt;BR /&gt; Looks to me like this is consistently your issue...&lt;BR /&gt;&lt;BR /&gt; Jason&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Apr 2004 11:24:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241397#M891268</guid>
      <dc:creator>Jason W. Neiss</dc:creator>
      <dc:date>2004-04-06T11:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Why does tar not work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241398#M891269</link>
      <description># tar tvf mfstrong.home.tar | wc                         &lt;BR /&gt;79 633 6292&lt;BR /&gt;root@hp19rm4 [/tmp] &lt;BR /&gt;# find /home/mfstrong | wc&lt;BR /&gt;105 106 3789&lt;BR /&gt;&lt;BR /&gt;hmm I see your point.</description>
      <pubDate>Tue, 06 Apr 2004 11:26:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241398#M891269</guid>
      <dc:creator>Marvin Strong</dc:creator>
      <dc:date>2004-04-06T11:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: Why does tar not work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241399#M891270</link>
      <description>Jason,&lt;BR /&gt;&lt;BR /&gt;in my opinion, there's no problem with the order of 'ft' or 'tf' or such things.&lt;BR /&gt;&lt;BR /&gt;Marvin, Sanya,&lt;BR /&gt;&lt;BR /&gt;anything new??&lt;BR /&gt;&lt;BR /&gt;Patrick,&lt;BR /&gt;&lt;BR /&gt;already at home? Really, no need to change to Linux?</description>
      <pubDate>Tue, 06 Apr 2004 11:42:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241399#M891270</guid>
      <dc:creator>Thomas Schler_1</dc:creator>
      <dc:date>2004-04-06T11:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: Why does tar not work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241400#M891271</link>
      <description>L.S.&lt;BR /&gt;&lt;BR /&gt;I think the problem is within the command sequence.&lt;BR /&gt;&lt;BR /&gt;Xargs takes as many arguments as possible, and starts the tar command with all these arguments. This means that tar will be started multiple times, each time overwriting the previously made tarfile. Your tarfile probably only contains the last XX files.&lt;BR /&gt;&lt;BR /&gt;Don't use xargs, just do&lt;BR /&gt;find .... | tar cvf tarfile.&lt;BR /&gt;&lt;BR /&gt;JP.</description>
      <pubDate>Tue, 06 Apr 2004 11:56:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241400#M891271</guid>
      <dc:creator>Jeroen Peereboom</dc:creator>
      <dc:date>2004-04-06T11:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: Why does tar not work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241401#M891272</link>
      <description>don't know whats up with tar, but if your aren't tied to tar, you could use cpio.  &lt;BR /&gt;&lt;BR /&gt;find dir | cpio -oc &amp;gt; output&lt;BR /&gt;&lt;BR /&gt;my results: &lt;BR /&gt;# find scripts | wc                     &lt;BR /&gt;68 68 1528&lt;BR /&gt;root@hp19rm4 [/home/mfstrong] &lt;BR /&gt;# find scripts | cpio -oc &amp;gt; scripts.cpio&lt;BR /&gt;349 blocks&lt;BR /&gt;# cpio -ict &amp;lt; scripts.cpio | wc         &lt;BR /&gt;349 blocks&lt;BR /&gt;68 68 1528</description>
      <pubDate>Tue, 06 Apr 2004 11:56:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241401#M891272</guid>
      <dc:creator>Marvin Strong</dc:creator>
      <dc:date>2004-04-06T11:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why does tar not work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241402#M891273</link>
      <description>what shell you are using? Seems csh.&lt;BR /&gt;type args, type tar&lt;BR /&gt;&lt;BR /&gt;Anil</description>
      <pubDate>Tue, 06 Apr 2004 12:05:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241402#M891273</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2004-04-06T12:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: Why does tar not work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241403#M891274</link>
      <description>There can be problems with the order arguments are given to many commands.  I do not think that this is the case here, but best practices should be to give "f" as the last argument, and the action first, in this case "c".  &lt;BR /&gt;&lt;BR /&gt;The reason for this is that other arguments may require additional arguments.  "b" immediately comes to mind.&lt;BR /&gt;I.E.&lt;BR /&gt;tar -cvbf 2048 - &lt;BR /&gt;&lt;BR /&gt;To fix the problem, try a different approach.&lt;BR /&gt;&lt;BR /&gt;tar -cvf myfiles.tar `find . -depth -print`&lt;BR /&gt;&lt;BR /&gt;Notice the grave marks enclosing the find command.  The grave marks tell the shell to execute the command enclosed to get it's arguments.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Shannon</description>
      <pubDate>Tue, 06 Apr 2004 12:10:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241403#M891274</guid>
      <dc:creator>Shannon Petry</dc:creator>
      <dc:date>2004-04-06T12:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: Why does tar not work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241404#M891275</link>
      <description>I just wanted to add a few things after re-reading a bit in the thread.&lt;BR /&gt;&lt;BR /&gt;"find tmp" is not compiant usage of the find command.  This could produce an empty list, or pathing issues.&lt;BR /&gt;&lt;BR /&gt;You do not state that an arcive is not made, just that the path is not reflected.  &lt;BR /&gt;&lt;BR /&gt;Is an archive made at all?  if so what is the contents?  There should be something in archive.&lt;BR /&gt;&lt;BR /&gt;If you want absolute pathing in the file, then find needs to give an absolute path.  &lt;BR /&gt;&lt;BR /&gt;find /tmp -depth -print &lt;BR /&gt;makes the absolute path /tmp&lt;BR /&gt;&lt;BR /&gt;find . -depth -print &lt;BR /&gt;makes the cwd the absolute path.&lt;BR /&gt;&lt;BR /&gt;Another problem I noticed is that in your -exec example you do not give the path to tar, which is required for execution.&lt;BR /&gt;&lt;BR /&gt;find /tmp -depth -exec /usr/bin/tar rf myfile.tar {} \;&lt;BR /&gt;&lt;BR /&gt;Try not to be lazy with command arguments.  While it may work under certain circumstances, it will not work in all cases.&lt;BR /&gt;&lt;BR /&gt;Lastly, which tar are you using? and are you using a hybred find?  It can make a difference if LD_LIBRARY_PATH needs to be adjusted.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Shannon</description>
      <pubDate>Tue, 06 Apr 2004 12:30:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241404#M891275</guid>
      <dc:creator>Shannon Petry</dc:creator>
      <dc:date>2004-04-06T12:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: Why does tar not work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241405#M891276</link>
      <description>I just checked on a Linux system.If you have many files, only the files found 'last' will be in the archive.So you may want to use an 'append' or 'update' mode. Linux tar has an 'r' flag, for append mode.This gave a weird result: the tar arhive contained twice as many files as were found by find. I do not understand (yet).So, using xargs causes the problem.My suggestion to use find ... | tar cvf is wrong. Won't work.JP</description>
      <pubDate>Tue, 06 Apr 2004 13:02:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241405#M891276</guid>
      <dc:creator>Jeroen Peereboom</dc:creator>
      <dc:date>2004-04-06T13:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: Why does tar not work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241406#M891277</link>
      <description>Probably the easiest thing to do is:&lt;BR /&gt;&lt;BR /&gt;# cd /tmp&lt;BR /&gt;# find . -print &amp;gt; /dir/file_list&lt;BR /&gt;# tar -cvf file.tar $(cat /dir/file_list)&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Apr 2004 13:05:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241406#M891277</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2004-04-06T13:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: Why does tar not work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241407#M891278</link>
      <description>Hi,&lt;BR /&gt;I think I once experienced something similar, namely that the argument list for xargs was too long. I also seem to remember that xargs does only produce an error message if you use it with the -x option.  Try testing your find commands like this:&lt;BR /&gt;# find &lt;START_POINT&gt; | xargs -x 1&amp;gt;/dev/null&lt;BR /&gt; &lt;BR /&gt;If it producces an error message like "xargs: arg list too long" we know what the problem is. If you can provoke that error message then try executing the above command without the "-x" option and without redirection.&lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;John K. &lt;BR /&gt;&lt;/START_POINT&gt;</description>
      <pubDate>Tue, 06 Apr 2004 13:06:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241407#M891278</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2004-04-06T13:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: Why does tar not work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241408#M891279</link>
      <description>John,&lt;BR /&gt;&lt;BR /&gt;by definition xargs cannot produce an argument list that is too long. Xargs will split the arguments such that the list is not too long, and the command (tar in this case) is called as few times as possible.&lt;BR /&gt;&lt;BR /&gt;My point is: xarsg will call tar a few times because there are so many files. Only the files (arguments) in the last invocation of tar (by xargs) will be in the tar archive. All previously created archives are overwritten.&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;&lt;BR /&gt;P.S. Of course, if you add an argument manually, the arglist may become too long.&lt;BR /&gt;&lt;BR /&gt;P.S. 2. The number of arguments in the list is smaller if filenames are longer.</description>
      <pubDate>Tue, 06 Apr 2004 13:38:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/why-does-tar-not-work/m-p/3241408#M891279</guid>
      <dc:creator>Jeroen Peereboom</dc:creator>
      <dc:date>2004-04-06T13:38:09Z</dc:date>
    </item>
  </channel>
</rss>

