<?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 find -exec rm question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/find-exec-rm-question/m-p/4714815#M660104</link>
    <description>I'm running a nightly cleanup script to clear files from a specific directory.  The script works as expected, however, now I have a sub-directory which is also being cleared.  This is the command I'm using&lt;BR /&gt;&lt;BR /&gt;find /sb/SB.EXC/data/EDI/alltests -type f -mtime +1 -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;What I want is to clear files in the ...alltest directory without affecting files in the ...alltest/AFEN directory.  Any help with amending or creating a new command line is greatly appreciated. &lt;BR /&gt;</description>
    <pubDate>Wed, 17 Nov 2010 20:57:34 GMT</pubDate>
    <dc:creator>Staci Tribelhorn</dc:creator>
    <dc:date>2010-11-17T20:57:34Z</dc:date>
    <item>
      <title>find -exec rm question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-exec-rm-question/m-p/4714815#M660104</link>
      <description>I'm running a nightly cleanup script to clear files from a specific directory.  The script works as expected, however, now I have a sub-directory which is also being cleared.  This is the command I'm using&lt;BR /&gt;&lt;BR /&gt;find /sb/SB.EXC/data/EDI/alltests -type f -mtime +1 -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;What I want is to clear files in the ...alltest directory without affecting files in the ...alltest/AFEN directory.  Any help with amending or creating a new command line is greatly appreciated. &lt;BR /&gt;</description>
      <pubDate>Wed, 17 Nov 2010 20:57:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-exec-rm-question/m-p/4714815#M660104</guid>
      <dc:creator>Staci Tribelhorn</dc:creator>
      <dc:date>2010-11-17T20:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: find -exec rm question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-exec-rm-question/m-p/4714816#M660105</link>
      <description>I think if you add the -prune option, you'll get what you want.</description>
      <pubDate>Wed, 17 Nov 2010 21:40:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-exec-rm-question/m-p/4714816#M660105</guid>
      <dc:creator>Jeff_Traigle</dc:creator>
      <dc:date>2010-11-17T21:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: find -exec rm question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-exec-rm-question/m-p/4714817#M660106</link>
      <description>Hi :&lt;BR /&gt;&lt;BR /&gt;# cd /sb/SB.EXC/data/EDI/alltests &amp;amp;&amp;amp; find .  ! -path "./AFEN*" -type f -mtime +1 -exec rm {} +&lt;BR /&gt;&lt;BR /&gt;Notice that we terminate the '-exec rm {}' with a "+".  This greatly improves performance by spawning a 'rm' command with multiple arguments.  For 'find' this variation of the '-exec' option acts as if you had used 'xargs' to bundle up many arguments for execution.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Nov 2010 22:31:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-exec-rm-question/m-p/4714817#M660106</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-11-17T22:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: find -exec rm question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-exec-rm-question/m-p/4714818#M660107</link>
      <description>&amp;gt;Jeff: I think if you add the -prune option, you'll get what you want.&lt;BR /&gt;&lt;BR /&gt;Since -prune is very complicated and rm is dangerous, here is what should work:&lt;BR /&gt;find /sb/SB.EXC/data/EDI/alltests -name AFEN -prune -o -type f -mtime +1 -exec echo rm {} +&lt;BR /&gt;&lt;BR /&gt;Remove the "echo" when you are satisfied it does what you want.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;JRF:  ! -path "./AFEN*" &lt;BR /&gt;&lt;BR /&gt;-prune is faster than a -path compare for the zillions of files in AFEN.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;For 'find' this variation of the '-exec' option acts as if you had used 'xargs' to bundle up many arguments for execution.&lt;BR /&gt;&lt;BR /&gt;This may be faster than xargs since find(1) packs the arg list full (Mb) but xargs is very limited (~2000?).</description>
      <pubDate>Thu, 18 Nov 2010 08:01:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-exec-rm-question/m-p/4714818#M660107</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-11-18T08:01:06Z</dc:date>
    </item>
  </channel>
</rss>

