<?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: using tar with xargs in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792978#M80248</link>
    <description>For your application (tar) the better way to do this is:&lt;BR /&gt;&lt;BR /&gt;tar cvf /mydir/myarc.tar .&lt;BR /&gt;&lt;BR /&gt;One tar and tar does all the argument expansion for you via the . to tar the current directory (and any subdirs).&lt;BR /&gt;</description>
    <pubDate>Fri, 23 Aug 2002 16:15:32 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2002-08-23T16:15:32Z</dc:date>
    <item>
      <title>using tar with xargs</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792975#M80245</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;I'm trying to tar a big number of files in a  directory(I know it's not a good practice to have so many files in a single directory), to avoid the "arg line too longs..." error, I'm going to use xargs with tar, like&lt;BR /&gt;&lt;BR /&gt;$ ls | xargs tar cvf myarc.tar &lt;BR /&gt;&lt;BR /&gt;xargs will break all files into small sets and feed to tar for several times, but the problem is, it seemed that the latest invoke of tar always over write the tar file generated of last time, and finally I got the "myarc.tar" file with only the last set of files, is there any work around here ?&lt;BR /&gt;&lt;BR /&gt;thanks,&lt;BR /&gt;Gary</description>
      <pubDate>Fri, 23 Aug 2002 16:07:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792975#M80245</guid>
      <dc:creator>Gary Yu</dc:creator>
      <dc:date>2002-08-23T16:07:02Z</dc:date>
    </item>
    <item>
      <title>Re: using tar with xargs</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792976#M80246</link>
      <description>&lt;BR /&gt;I'm confused?&lt;BR /&gt;&lt;BR /&gt;why not&lt;BR /&gt;&lt;BR /&gt;tar -cvf myarc.tar .&lt;BR /&gt;&lt;BR /&gt;??&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Fri, 23 Aug 2002 16:14:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792976#M80246</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-08-23T16:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: using tar with xargs</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792977#M80247</link>
      <description>Hi Gary:&lt;BR /&gt;&lt;BR /&gt;Specify a non-rewind tape device, explicitly as the destination (e.g. /dev/rmt/omn) or use the '-r' option of 'tar' to append to the archive.  See the man pages for more information.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 23 Aug 2002 16:14:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792977#M80247</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-08-23T16:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: using tar with xargs</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792978#M80248</link>
      <description>For your application (tar) the better way to do this is:&lt;BR /&gt;&lt;BR /&gt;tar cvf /mydir/myarc.tar .&lt;BR /&gt;&lt;BR /&gt;One tar and tar does all the argument expansion for you via the . to tar the current directory (and any subdirs).&lt;BR /&gt;</description>
      <pubDate>Fri, 23 Aug 2002 16:15:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792978#M80248</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-08-23T16:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: using tar with xargs</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792979#M80249</link>
      <description>I don't think you'll get the results you want. "xargs" runs tar multiple times, thus the last tar run will be the only thing on the tape.&lt;BR /&gt;&lt;BR /&gt;If you have a list of files to copy you can use "cpio". If you want to tar all files is a directory, you can do-&lt;BR /&gt;&lt;BR /&gt;cd directory&lt;BR /&gt;tar cvf myarc.tar .&lt;BR /&gt;&lt;BR /&gt;hope this helps.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Fri, 23 Aug 2002 16:16:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792979#M80249</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2002-08-23T16:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: using tar with xargs</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792980#M80250</link>
      <description>Hi Gary,&lt;BR /&gt;&lt;BR /&gt;you could try the *key* "r" (rewrite) instead of "c" (create).&lt;BR /&gt;&lt;BR /&gt;Just my $0.02,&lt;BR /&gt;Wodisch&lt;BR /&gt;</description>
      <pubDate>Fri, 23 Aug 2002 16:28:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792980#M80250</guid>
      <dc:creator>Wodisch_1</dc:creator>
      <dc:date>2002-08-23T16:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: using tar with xargs</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792981#M80251</link>
      <description>Hi Gary,&lt;BR /&gt;&lt;BR /&gt; I agree with Wodisch.&lt;BR /&gt;touch /other_dir/myarc.tar &lt;BR /&gt;then&lt;BR /&gt;ls | xargs tar rvf /other_dir/myarc.tar&lt;BR /&gt;You need to add them to the archive - not create a new archive every pass.&lt;BR /&gt;Also you should tar them into another directory or you'll get a recursive tar file.&lt;BR /&gt;&lt;BR /&gt;Rgds,&lt;BR /&gt;Jeff</description>
      <pubDate>Fri, 23 Aug 2002 16:34:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792981#M80251</guid>
      <dc:creator>Jeff Schussele</dc:creator>
      <dc:date>2002-08-23T16:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: using tar with xargs</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792982#M80252</link>
      <description>Gary,&lt;BR /&gt;&lt;BR /&gt;tar doesn't allow the "r" option (which appends files to the end of a tar) if the tar doesn't already exist.  So if you don't mind getting a duplicate file in your archive (maybe some junk file called "hello" that contains the word "hello") do the following.&lt;BR /&gt;&lt;BR /&gt;Put this file "hello" in the directory you plan to tar.&lt;BR /&gt;&lt;BR /&gt;cd to the directory.  Run the following two commands in sequence:&lt;BR /&gt;&lt;BR /&gt;ls | xargs -i tar cf myTar.tar&lt;BR /&gt;&lt;BR /&gt;then:&lt;BR /&gt;&lt;BR /&gt;ls | xargs -i tar rf myTar.tar&lt;BR /&gt;&lt;BR /&gt;I tested this and it worked perfectly.  You could also do this to a tape.&lt;BR /&gt;&lt;BR /&gt;You'll wind up with a double copy of the "hello" file, but it'll just overwrite itself when you extract anyway.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;- Allan&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 23 Aug 2002 16:49:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792982#M80252</guid>
      <dc:creator>Allan Pincus</dc:creator>
      <dc:date>2002-08-23T16:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: using tar with xargs</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792983#M80253</link>
      <description>thank you all for the prompt response, I can always get help from here!&lt;BR /&gt;&lt;BR /&gt;Yes, '-r' with tar does the work, but fyi Jeff, I did try "touch arch.tar" to create a tar file to use '-r', but tar complained about the file format :&lt;BR /&gt;&lt;BR /&gt;Tar: blocksize = 0; broken pipe?&lt;BR /&gt;&lt;BR /&gt;so I have to create a dummy file and make it into tar file.&lt;BR /&gt;&lt;BR /&gt;I also learned that '.' with tar can also expand all the files ...&lt;BR /&gt;&lt;BR /&gt;thank you all again.&lt;BR /&gt;&lt;BR /&gt;Gary</description>
      <pubDate>Fri, 23 Aug 2002 16:52:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792983#M80253</guid>
      <dc:creator>Gary Yu</dc:creator>
      <dc:date>2002-08-23T16:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: using tar with xargs</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792984#M80254</link>
      <description>Gary, &lt;BR /&gt;&lt;BR /&gt;OOPS!!!&lt;BR /&gt;&lt;BR /&gt;I missed something in my commands. Do the following two commands: &lt;BR /&gt;&lt;BR /&gt;ls hello | xargs -i tar cf myTar.tar {} &lt;BR /&gt;&lt;BR /&gt;then: &lt;BR /&gt;&lt;BR /&gt;ls | xargs -i tar rf myTar.tar {} &lt;BR /&gt;&lt;BR /&gt;That'll do it!!!! &lt;BR /&gt;&lt;BR /&gt;- Allan</description>
      <pubDate>Fri, 23 Aug 2002 16:57:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-tar-with-xargs/m-p/2792984#M80254</guid>
      <dc:creator>Allan Pincus</dc:creator>
      <dc:date>2002-08-23T16:57:13Z</dc:date>
    </item>
  </channel>
</rss>

