<?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: find command... in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270699#M178602</link>
    <description>&lt;BR /&gt;yes, the "-type d" is what you want, but&lt;BR /&gt;to list the acutal directories found do:&lt;BR /&gt;&lt;BR /&gt;use: "-exec ls -ld {} \;"&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 07 May 2004 10:09:47 GMT</pubDate>
    <dc:creator>Tom Dineen_2</dc:creator>
    <dc:date>2004-05-07T10:09:47Z</dc:date>
    <item>
      <title>find command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270696#M178599</link>
      <description>I'm having a little trouble getting find to do what I want it to. Here is the deal:&lt;BR /&gt;I have a directory that has a bunch of directories. I want to remove all directories inside that directory that are older than 90 days, using the timestamp of that directory. Example:&lt;BR /&gt;# ll /maindir&lt;BR /&gt;drwxrwsr-x   4 speclive   live          8192 Aug 17  2003 dir1&lt;BR /&gt;drwxrwsr-x   4 spxlive    live          8192 May  7 09:32 dir2&lt;BR /&gt;drwxrwsr-x   4 spxlive    live          8192 May  3 05:33 dir3&lt;BR /&gt;drwxrwsr-x   2 spxlive    live            96 Jan 24 14:59 dir4&lt;BR /&gt;&lt;BR /&gt;Therefore I would want dir1 and dir4 deleted, with all the contents under them.&lt;BR /&gt;Also, I would first want to list which directories I selected, then remove them (these can be in two different find commands). Here is what I have so far, but it's working right:&lt;BR /&gt;find /maindir -name * +mtime +90 -exec ll {} \;&lt;BR /&gt;find /maindir -name * +mtime +90 -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;I've also tried playing with -prune, but it doesn't do what I want.&lt;BR /&gt;10 points to the person who can help me solve this! Thanks!&lt;BR /&gt;&lt;BR /&gt;-Hazem</description>
      <pubDate>Fri, 07 May 2004 10:02:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270696#M178599</guid>
      <dc:creator>Hazem Mahmoud_3</dc:creator>
      <dc:date>2004-05-07T10:02:12Z</dc:date>
    </item>
    <item>
      <title>Re: find command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270697#M178600</link>
      <description>Hazem&lt;BR /&gt;I think you're close but you need to specify the directory option:&lt;BR /&gt;&lt;BR /&gt;find /maindir -type d -name * +mtime +90 -exec ll {} \;&lt;BR /&gt;&lt;BR /&gt;find /maindir -type d -name * +mtime +90 -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 07 May 2004 10:06:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270697#M178600</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2004-05-07T10:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: find command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270698#M178601</link>
      <description>You should add the "-type d" option to your find to select only directories. You could also remove "-name *" for 2 reasons :&lt;BR /&gt;&lt;BR /&gt;1. * is evaluated by your shell when launching so it will only find dirs that are in your start dir ".". You should put&lt;BR /&gt;-name "*" instead so that * is evaluated each time&lt;BR /&gt;&lt;BR /&gt;2. -name "*" is what is done by default if you don't put -name.&lt;BR /&gt;&lt;BR /&gt;So your command could be :&lt;BR /&gt;find /maindir -type d +mtime +90 -exec ll {} \;&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;&lt;BR /&gt;Fred&lt;BR /&gt;</description>
      <pubDate>Fri, 07 May 2004 10:08:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270698#M178601</guid>
      <dc:creator>Fred Ruffet</dc:creator>
      <dc:date>2004-05-07T10:08:48Z</dc:date>
    </item>
    <item>
      <title>Re: find command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270699#M178602</link>
      <description>&lt;BR /&gt;yes, the "-type d" is what you want, but&lt;BR /&gt;to list the acutal directories found do:&lt;BR /&gt;&lt;BR /&gt;use: "-exec ls -ld {} \;"&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 07 May 2004 10:09:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270699#M178602</guid>
      <dc:creator>Tom Dineen_2</dc:creator>
      <dc:date>2004-05-07T10:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: find command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270700#M178603</link>
      <description>I tried it with type -d and here is the message I got:&lt;BR /&gt;find: missing conjunction&lt;BR /&gt;&lt;BR /&gt;I also tried it without the -name option.&lt;BR /&gt;&lt;BR /&gt;-Hazem</description>
      <pubDate>Fri, 07 May 2004 10:15:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270700#M178603</guid>
      <dc:creator>Hazem Mahmoud_3</dc:creator>
      <dc:date>2004-05-07T10:15:37Z</dc:date>
    </item>
    <item>
      <title>Re: find command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270701#M178604</link>
      <description>Another point :&lt;BR /&gt;&lt;BR /&gt;using "ll {}\;" will list the content of each directory found. you should use -d option to see the directory itself.&lt;BR /&gt;&lt;BR /&gt;So it will look :&lt;BR /&gt;find /maindir -type d +mtime +90 -exec ll -d {} \;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Fred&lt;BR /&gt;</description>
      <pubDate>Fri, 07 May 2004 10:15:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270701#M178604</guid>
      <dc:creator>Fred Ruffet</dc:creator>
      <dc:date>2004-05-07T10:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: find command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270702#M178605</link>
      <description>I didn't saw the +mtime... use -mtime instead.&lt;BR /&gt;</description>
      <pubDate>Fri, 07 May 2004 10:17:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270702#M178605</guid>
      <dc:creator>Fred Ruffet</dc:creator>
      <dc:date>2004-05-07T10:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: find command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270703#M178606</link>
      <description>Ok, we're getting closer, but not there yet. Here is what I used:&lt;BR /&gt;find /maindir -type d -mtime +90 -exec ll -d {} \;&lt;BR /&gt;&lt;BR /&gt;Good catch on the -mtime Fred, that was one of my problems. Also, it did not like it when I specified -name *, so another good catch on that one Fred.&lt;BR /&gt;However, it is giving me all directories under /maindir, including the sub-directores under the directories in /maindir. So it is still recursively going down the directory structure. It is however giving me the directores older than 90 days that are directly under /maindir.&lt;BR /&gt;Any ideas how to stop it from going further down the directory structure?&lt;BR /&gt;&lt;BR /&gt;-Hazem</description>
      <pubDate>Fri, 07 May 2004 10:26:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270703#M178606</guid>
      <dc:creator>Hazem Mahmoud_3</dc:creator>
      <dc:date>2004-05-07T10:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: find command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270704#M178607</link>
      <description>Another answer again (I'm a bit tired) :&lt;BR /&gt;&lt;BR /&gt;about the concept this time. It's not because your dir has a modification date older than 90 days that all of its subdirs will be older than 90 days.&lt;BR /&gt;&lt;BR /&gt;Once you'll run the find with ll, take the answers, and do the same find with "-mtime -90" on them...&lt;BR /&gt;</description>
      <pubDate>Fri, 07 May 2004 10:27:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270704#M178607</guid>
      <dc:creator>Fred Ruffet</dc:creator>
      <dc:date>2004-05-07T10:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: find command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270705#M178608</link>
      <description>for your recursive problem, it's time to use -prune. Each matching dir will be skipped.&lt;BR /&gt;&lt;BR /&gt;Fred&lt;BR /&gt;</description>
      <pubDate>Fri, 07 May 2004 10:32:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270705#M178608</guid>
      <dc:creator>Fred Ruffet</dc:creator>
      <dc:date>2004-05-07T10:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: find command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270706#M178609</link>
      <description>When I use -prune it does not pick up anything.&lt;BR /&gt;&lt;BR /&gt;-Hazem</description>
      <pubDate>Fri, 07 May 2004 10:34:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270706#M178609</guid>
      <dc:creator>Hazem Mahmoud_3</dc:creator>
      <dc:date>2004-05-07T10:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: find command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270707#M178610</link>
      <description>I have this :&lt;BR /&gt;&lt;BR /&gt;#find /etc -type d -mtime +90 -prune -exec ls -ld {} \;&lt;BR /&gt;dr-xr--r--   4 bin        bin             96 Nov 15  2000 /etc/ftpd&lt;BR /&gt;dr-xr-xr-x  11 bin        bin           8192 Jan 14 07:41 /etc/vx&lt;BR /&gt;dr-xr-xr-x   2 bin        bin           8192 Jan 14 07:17 /etc/hpC2400&lt;BR /&gt;dr-xr-xr-x   2 bin        bin             96 Nov 15  2000 /etc/local&lt;BR /&gt;dr-xr-xr-x   2 bin        bin             96 Jan 14 07:59 /etc/default&lt;BR /&gt;dr-xr-xr-x   2 bin        bin             96 Nov 15  2000 /etc/hparray&lt;BR /&gt;drwxr-xr-x   4 root       sys             96 Nov 15  2000 /etc/vhelp&lt;BR /&gt;drwxr-xr-x   3 bin        bin           8192 Nov 15  2000 /etc/ppp&lt;BR /&gt;dr-xr-xr-x   3 bin        bin           8192 Jan 14 17:49 /etc/sam&lt;BR /&gt;drwxr-xr-x  12 root       bin           8192 Jan 14 07:57 /etc/opt&lt;BR /&gt;drwxr-xr-x   2 bin        bin             96 Nov 15  2000 /etc/gss&lt;BR /&gt;drwxr-xr-x   2 bin        bin             96 Nov 15  2000 /etc/acct&lt;BR /&gt;drwxr-xr-x   3 bin        bin             96 Nov 15  2000 /etc/asx&lt;BR /&gt;drwxr-xr-x   8 lp         bin           8192 Nov 15  2000 /etc/lp&lt;BR /&gt;dr-xr-xr-x   2 bin        bin           8192 Nov 15  2000 /etc/uucp&lt;BR /&gt;drwxr-xr-x   8 root       sys           8192 Jan 14 07:57 /etc/X11&lt;BR /&gt;drwxr-xr-x   3 bin        bin             96 Nov 15  2000 /etc/vue&lt;BR /&gt;drwxr-xr-x   5 bin        bin             96 Nov 15  2000 /etc/net&lt;BR /&gt;drwxr-xr-x   4 bin        bin             96 Jan 14 07:53 /etc/dt&lt;BR /&gt;dr-xr-xr-x   2 bin        bin             96 Jan 14 07:17 /etc/switch&lt;BR /&gt;dr-xr-xr-x   2 bin        bin           8192 Jan 14 07:17 /etc/eisa&lt;BR /&gt;drwxr-xr-x   3 root       root            96 Jan 14 07:23 /etc/.java&lt;BR /&gt;dr-xr-xr-x   3 bin        bin             96 Jan 14 07:41 /etc/cmcluster&lt;BR /&gt;drwxr-xr-x   2 root       sys             96 Jan 14 07:54 /etc/ximian&lt;BR /&gt;&lt;BR /&gt;Difference with or whitout -prune :&lt;BR /&gt;&lt;BR /&gt;#find /etc -type d -mtime +90 -prune -exec ls -ld {} \; | wc -l&lt;BR /&gt;24&lt;BR /&gt;#find /etc -type d -mtime +90  -exec ls -ld {} \; | wc -l&lt;BR /&gt;187&lt;BR /&gt;&lt;BR /&gt;Fred&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 07 May 2004 10:56:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270707#M178610</guid>
      <dc:creator>Fred Ruffet</dc:creator>
      <dc:date>2004-05-07T10:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: find command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270708#M178611</link>
      <description>That did it Fred!!! I had prune running before the -mtime and it seems like it did not like that (I'm not sure why). So I had it run after the -mtime and it worked great! Thanks for all your help troubleshooting this!!!&lt;BR /&gt;&lt;BR /&gt;-Hazem</description>
      <pubDate>Fri, 07 May 2004 11:39:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270708#M178611</guid>
      <dc:creator>Hazem Mahmoud_3</dc:creator>
      <dc:date>2004-05-07T11:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: find command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270709#M178612</link>
      <description>Fred is correct:&lt;BR /&gt;&lt;BR /&gt;# find /etc -type d -mtime +90 -exec ls -d {} \; |wc&lt;BR /&gt;175 175 4468&lt;BR /&gt;# find /etc -type d -mtime +90 -prune -exec ls -d {} \; |wc&lt;BR /&gt;46 46 680&lt;BR /&gt;&lt;BR /&gt;Now - as far as rm, it won't delete directory's if they have contents  - unless you do a rm -rf   and that is dangerous!&lt;BR /&gt;&lt;BR /&gt;I would be more inclined to find all dirs over 90 days, list their contents, then delete the files under them - just to be safe....&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Fri, 07 May 2004 11:42:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270709#M178612</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2004-05-07T11:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: find command...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270710#M178613</link>
      <description>Thanks for the information Geoff, I'll definitely take that into consideration.&lt;BR /&gt;&lt;BR /&gt;Congratulations on your new hat Fred!!! I hope your first hat feels good!:)&lt;BR /&gt;&lt;BR /&gt;-Hazem</description>
      <pubDate>Fri, 07 May 2004 11:46:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/find-command/m-p/3270710#M178613</guid>
      <dc:creator>Hazem Mahmoud_3</dc:creator>
      <dc:date>2004-05-07T11:46:46Z</dc:date>
    </item>
  </channel>
</rss>

