<?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 prune to exclude directories when running find command. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/using-prune-to-exclude-directories-when-running-find-command/m-p/3111255#M148874</link>
    <description>This message reminded me of a problem with the HP version of the "find" command that has existed for years.  I haven't tested it lately, but will test again when I have time.  The problem is that the -prune does not stop the find from going down the directory tree, it only stops find from reporting results from having gone down the directory tree.  Normally, this would only be a slight waste of cpu cycles and time while it follows the directories and then exludes the results from the -prune directory.  However, when the HP is running the AFS cache manager, the find tries to follow the /afs directory and circle the world.  The find only gives up a couple of days later after filling /tmp or /var/tmp with it's working file.</description>
    <pubDate>Wed, 05 Nov 2003 21:32:15 GMT</pubDate>
    <dc:creator>Ray Carlson</dc:creator>
    <dc:date>2003-11-05T21:32:15Z</dc:date>
    <item>
      <title>Using prune to exclude directories when running find command.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-prune-to-exclude-directories-when-running-find-command/m-p/3111251#M148870</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I'm having a hard time figuring out the right "find" syntax with "prune".  I have these directories and files in it:&lt;BR /&gt;&lt;BR /&gt; /tmp/dir1&lt;BR /&gt; /tmp/dir1/one&lt;BR /&gt; /tmp/dir1/two&lt;BR /&gt; /tmp/dir2&lt;BR /&gt; /tmp/dir2/one&lt;BR /&gt; /tmp/dir2/two&lt;BR /&gt; /tmp/dir3&lt;BR /&gt; /tmp/dir3/one&lt;BR /&gt; /tmp/dir3/two&lt;BR /&gt;&lt;BR /&gt;Now I want to find and delete all files having the name "one" but exclude those belongs to /tmp/dir/two directory.&lt;BR /&gt;&lt;BR /&gt;Any help would be greatly appreciated.&lt;BR /&gt;Thanks in advance&lt;BR /&gt;Kurt</description>
      <pubDate>Wed, 05 Nov 2003 11:39:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-prune-to-exclude-directories-when-running-find-command/m-p/3111251#M148870</guid>
      <dc:creator>Kurt Karl</dc:creator>
      <dc:date>2003-11-05T11:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using prune to exclude directories when running find command.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-prune-to-exclude-directories-when-running-find-command/m-p/3111252#M148871</link>
      <description>hope this helps - you need to use the ! -name options for what you want;&lt;BR /&gt;&lt;BR /&gt;To delete all files in a dir but DONT include subdirs;&lt;BR /&gt;&lt;BR /&gt;find . \( -type d ! -name . -prune \) -o \( -type f -name "*" ! -name "." -print \) -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;To delete all files older than 7 days in current dir only (no subdirs);&lt;BR /&gt;&lt;BR /&gt;find . \( -type d ! -name . -prune \) -o \( -type f -mtime +7 ! -name "." -print \) -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;To delete all subdirs in a dir;&lt;BR /&gt;&lt;BR /&gt;find . \( -type f ! -name . -prune \) -o \( -type d -name "*" ! -name "lost+found" ! -name "." -print \) -exec rmdir {} \;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 05 Nov 2003 11:48:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-prune-to-exclude-directories-when-running-find-command/m-p/3111252#M148871</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2003-11-05T11:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using prune to exclude directories when running find command.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-prune-to-exclude-directories-when-running-find-command/m-p/3111253#M148872</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;in the thread&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=241011" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=241011&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I suggested this solution to a similar question:&lt;BR /&gt;...&lt;BR /&gt;find . \( -name ign1 -prune -o -name ign2 -prune \) -o -print&lt;BR /&gt;&lt;BR /&gt;For a (variable) list of dirs I simply generate the option-arglist for find:&lt;BR /&gt;excl='one&lt;BR /&gt;two&lt;BR /&gt;three'&lt;BR /&gt;&lt;BR /&gt;findopt=$(print "$excl" |&lt;BR /&gt;awk 'NR==1 {printf("( -name %s -prune ",$1);next}&lt;BR /&gt;{printf("-o -name %s -prune ",$1)}&lt;BR /&gt;END {print(")")}')&lt;BR /&gt;&lt;BR /&gt;find . $findopt -o -print&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Wed, 05 Nov 2003 12:34:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-prune-to-exclude-directories-when-running-find-command/m-p/3111253#M148872</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2003-11-05T12:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using prune to exclude directories when running find command.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-prune-to-exclude-directories-when-running-find-command/m-p/3111254#M148873</link>
      <description>Using -path can do it instead of -prune. You would use -prune to prevent descending to a certain level in the tree structure.&lt;BR /&gt; &lt;BR /&gt;find /tmp -type f -name one ! -path "/tmp/dir/two*" -exec rm {} \;&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Wed, 05 Nov 2003 12:55:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-prune-to-exclude-directories-when-running-find-command/m-p/3111254#M148873</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2003-11-05T12:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using prune to exclude directories when running find command.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-prune-to-exclude-directories-when-running-find-command/m-p/3111255#M148874</link>
      <description>This message reminded me of a problem with the HP version of the "find" command that has existed for years.  I haven't tested it lately, but will test again when I have time.  The problem is that the -prune does not stop the find from going down the directory tree, it only stops find from reporting results from having gone down the directory tree.  Normally, this would only be a slight waste of cpu cycles and time while it follows the directories and then exludes the results from the -prune directory.  However, when the HP is running the AFS cache manager, the find tries to follow the /afs directory and circle the world.  The find only gives up a couple of days later after filling /tmp or /var/tmp with it's working file.</description>
      <pubDate>Wed, 05 Nov 2003 21:32:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-prune-to-exclude-directories-when-running-find-command/m-p/3111255#M148874</guid>
      <dc:creator>Ray Carlson</dc:creator>
      <dc:date>2003-11-05T21:32:15Z</dc:date>
    </item>
  </channel>
</rss>

