<?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: Remove audit files in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-audit-files/m-p/2781726#M77381</link>
    <description>If you prefer, you can use the Perl version, caljd.pl. The arguments are exactly the same simply substitute caljd.pl for caljd.sh.&lt;BR /&gt;&lt;BR /&gt;Note that I commented out the actual rm command. After you are satified with the results, you can uncomment the command.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Attached is caljd.pl.&lt;BR /&gt;&lt;BR /&gt;Regards, Clay&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 07 Aug 2002 18:41:56 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2002-08-07T18:41:56Z</dc:date>
    <item>
      <title>Remove audit files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-audit-files/m-p/2781722#M77377</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I have a directory /user1/audit which has hundreds of files in it with names like "01-Aug-2002", "12-Dec-2001", and "13-Jun-2000". We only need to keep the files that are less than 31 days old. Is there a command to remove these files?&lt;BR /&gt;&lt;BR /&gt;TIA, Derek</description>
      <pubDate>Wed, 07 Aug 2002 18:12:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-audit-files/m-p/2781722#M77377</guid>
      <dc:creator>Derek Card</dc:creator>
      <dc:date>2002-08-07T18:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: Remove audit files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-audit-files/m-p/2781723#M77378</link>
      <description>Sure.&lt;BR /&gt;&lt;BR /&gt;find /user1/audit -type f -mtime +30 -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;I would first try this command with a safe command like -exec echo {} \; before doing the real thing.&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Aug 2002 18:14:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-audit-files/m-p/2781723#M77378</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-08-07T18:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Remove audit files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-audit-files/m-p/2781724#M77379</link>
      <description>Hello again,&lt;BR /&gt;&lt;BR /&gt;I forget to add before anybody does a find -mtime that I can't use find because the file "12-Dec-2001" might not have been created on December 12, 2001. I know it's dumb but I didn't write the software. I actually need to figure out how old a file is based on the name of the file.&lt;BR /&gt;&lt;BR /&gt;TIA, Derek</description>
      <pubDate>Wed, 07 Aug 2002 18:18:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-audit-files/m-p/2781724#M77379</guid>
      <dc:creator>Derek Card</dc:creator>
      <dc:date>2002-08-07T18:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: Remove audit files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-audit-files/m-p/2781725#M77380</link>
      <description>Okay Derek, you want to make this complicated. Well, this is a job for my date sledgehammer, caljd.sh.&lt;BR /&gt;&lt;BR /&gt;This should be very close:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;DIRNAME=/user1/audit&lt;BR /&gt;MAX_DAYS=30&lt;BR /&gt;&lt;BR /&gt;cd ${DIRNAME}&lt;BR /&gt;TODAY=$(caljd.sh)&lt;BR /&gt;for F in $(ls)&lt;BR /&gt;  do&lt;BR /&gt;    if [[ -f ${F} ]]&lt;BR /&gt;      then&lt;BR /&gt;        echo "File: ${F}\t\c"&lt;BR /&gt;        AGE=$((${TODAY} - $(caljd.sh -e -i -S "-" -c ${F})))&lt;BR /&gt;        echo "Age: ${AGE} days\c"&lt;BR /&gt;        if [[ ${AGE} -gt ${MAX_DAYS} ]]&lt;BR /&gt;          then&lt;BR /&gt;            echo "\tRemove\c"&lt;BR /&gt;#           rm ${F}&lt;BR /&gt;          fi&lt;BR /&gt;        echo&lt;BR /&gt;      fi&lt;BR /&gt;  done&lt;BR /&gt;&lt;BR /&gt;You can invoke caljd.sh -u for full usage. Make sure that you use Version 2.1; earlier versions could not handle dates with names of months.&lt;BR /&gt;&lt;BR /&gt;Here is caljd.sh.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Aug 2002 18:36:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-audit-files/m-p/2781725#M77380</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-08-07T18:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: Remove audit files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-audit-files/m-p/2781726#M77381</link>
      <description>If you prefer, you can use the Perl version, caljd.pl. The arguments are exactly the same simply substitute caljd.pl for caljd.sh.&lt;BR /&gt;&lt;BR /&gt;Note that I commented out the actual rm command. After you are satified with the results, you can uncomment the command.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Attached is caljd.pl.&lt;BR /&gt;&lt;BR /&gt;Regards, Clay&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Aug 2002 18:41:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-audit-files/m-p/2781726#M77381</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-08-07T18:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: Remove audit files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-audit-files/m-p/2781727#M77382</link>
      <description>Thanks very much, Clay! I removed the comments from the rm command and it worked perfectly! I'm going to now make a cron entry to run this command.&lt;BR /&gt;&lt;BR /&gt;Thanks again, Derek&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Aug 2002 19:05:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-audit-files/m-p/2781727#M77382</guid>
      <dc:creator>Derek Card</dc:creator>
      <dc:date>2002-08-07T19:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: Remove audit files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-audit-files/m-p/2781728#M77383</link>
      <description>Hi Derek:&lt;BR /&gt;&lt;BR /&gt;Before you turn this into a cronjob, you need to make sure that caljd.sh is in the PATH and exported. I would do this explicitly in the script. Cron has an intentionally sparse environment. I would also remove all the echo commands or add a command line option for verbose if you want to keep them in.&lt;BR /&gt;&lt;BR /&gt;Regards, Clay</description>
      <pubDate>Wed, 07 Aug 2002 19:09:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-audit-files/m-p/2781728#M77383</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-08-07T19:09:23Z</dc:date>
    </item>
  </channel>
</rss>

