<?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: Help in script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-script/m-p/4250551#M331471</link>
    <description>How about something like.&lt;BR /&gt;&lt;BR /&gt;find /config.* - type d -mtime +5 |while read list&lt;BR /&gt;do&lt;BR /&gt;rm -r $list&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;(I would be carefull about rm -r, maybe even build a file list and rm $list then rmdir the directory.)  If your list returns just "/" you will be bumming.&lt;BR /&gt;&lt;BR /&gt;If you try to use each name mmddyy + 5 days you will run into the always difficult roll at EOM.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 12 Aug 2008 12:17:11 GMT</pubDate>
    <dc:creator>Tim Nelson</dc:creator>
    <dc:date>2008-08-12T12:17:11Z</dc:date>
    <item>
      <title>Help in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-script/m-p/4250550#M331470</link>
      <description>Can some one help me in writing a script with the following functionality.&lt;BR /&gt;&lt;BR /&gt;Every time the script runs, it makes a directory naming config.mmddyy and stores configuration information in it. I have made a script upto this point.&lt;BR /&gt;Now I want to keep only the latest 5 directories and delete the diectories other than them with the information in them .</description>
      <pubDate>Tue, 12 Aug 2008 11:53:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-in-script/m-p/4250550#M331470</guid>
      <dc:creator>Waqar Razi</dc:creator>
      <dc:date>2008-08-12T11:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: Help in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-script/m-p/4250551#M331471</link>
      <description>How about something like.&lt;BR /&gt;&lt;BR /&gt;find /config.* - type d -mtime +5 |while read list&lt;BR /&gt;do&lt;BR /&gt;rm -r $list&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;(I would be carefull about rm -r, maybe even build a file list and rm $list then rmdir the directory.)  If your list returns just "/" you will be bumming.&lt;BR /&gt;&lt;BR /&gt;If you try to use each name mmddyy + 5 days you will run into the always difficult roll at EOM.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Aug 2008 12:17:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-in-script/m-p/4250551#M331471</guid>
      <dc:creator>Tim Nelson</dc:creator>
      <dc:date>2008-08-12T12:17:11Z</dc:date>
    </item>
    <item>
      <title>Re: Help in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-script/m-p/4250552#M331472</link>
      <description>Hi Wagar:&lt;BR /&gt;&lt;BR /&gt;# ls -lt|grep ^d|tail +5|awk '{print $NF}'|xargs rmdir&lt;BR /&gt;&lt;BR /&gt;...assuming that the directories are ones immediately beneath the current working directory and that they are empty.  If they are not empty, but you want to delete them and their contents, then:&lt;BR /&gt;&lt;BR /&gt;# ls -lt|grep ^d|tail +5|awk '{print $NF}'|xargs rm -rf&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 12 Aug 2008 12:20:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-in-script/m-p/4250552#M331472</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-08-12T12:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: Help in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-script/m-p/4250553#M331473</link>
      <description>&amp;gt; [...] config.mmddyy [...]&lt;BR /&gt;&lt;BR /&gt;If you used a naming scheme like yymmdd&lt;BR /&gt;instead of mmddyy, it would be easier to sort&lt;BR /&gt;the names chronologically, so techniques like&lt;BR /&gt;piping "ls" output into "head" or "tail"&lt;BR /&gt;could do useful things (easily).</description>
      <pubDate>Tue, 12 Aug 2008 12:51:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-in-script/m-p/4250553#M331473</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2008-08-12T12:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/help-in-script/m-p/4250554#M331474</link>
      <description>You could create 5 symlinks that point to the last 5 directories.  Then when you create a new one, you shuffle them down.&lt;BR /&gt;To remove what the symlink points to, you can use:  rm -rf symlink01/&lt;BR /&gt;&lt;BR /&gt;To shuffle them down, you would have to parse the output of ll(1) to get the link target.</description>
      <pubDate>Wed, 13 Aug 2008 10:18:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/help-in-script/m-p/4250554#M331474</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-08-13T10:18:11Z</dc:date>
    </item>
  </channel>
</rss>

