<?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: Script help – record all files deleted by the script. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-record-all-files-deleted-by-the-script/m-p/3774705#M261933</link>
    <description>Something like this work for you. You can have multiple -exec clauses on find.&lt;BR /&gt;&lt;BR /&gt;find $1 -mtime +$2 -exec ls -l {} \; -exec rm -rf {} \; &amp;gt;&amp;gt; logfile</description>
    <pubDate>Thu, 20 Apr 2006 08:20:36 GMT</pubDate>
    <dc:creator>Jeff_Traigle</dc:creator>
    <dc:date>2006-04-20T08:20:36Z</dc:date>
    <item>
      <title>Script help – record all files deleted by the script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-record-all-files-deleted-by-the-script/m-p/3774704#M261932</link>
      <description>Following script is being executed by Cron every night which removes some old logs files and directories.&lt;BR /&gt;&lt;BR /&gt;I would like to log or record all files/directories removed by this shell script.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;function purge_logs&lt;BR /&gt;{&lt;BR /&gt;find $1 -mtime +$2 -exec rm -rf {} \;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;purge_logs /psoft/hrcat88a/LOGS 30&lt;BR /&gt;purge_logs /psoft/hrcat88b/LOGS 60&lt;BR /&gt;purge_logs /psoft/hrcat88c/LOGS 90&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Gulam.&lt;BR /&gt;</description>
      <pubDate>Thu, 20 Apr 2006 08:12:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-record-all-files-deleted-by-the-script/m-p/3774704#M261932</guid>
      <dc:creator>Gulam Mohiuddin</dc:creator>
      <dc:date>2006-04-20T08:12:06Z</dc:date>
    </item>
    <item>
      <title>Re: Script help – record all files deleted by the script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-record-all-files-deleted-by-the-script/m-p/3774705#M261933</link>
      <description>Something like this work for you. You can have multiple -exec clauses on find.&lt;BR /&gt;&lt;BR /&gt;find $1 -mtime +$2 -exec ls -l {} \; -exec rm -rf {} \; &amp;gt;&amp;gt; logfile</description>
      <pubDate>Thu, 20 Apr 2006 08:20:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-record-all-files-deleted-by-the-script/m-p/3774705#M261933</guid>
      <dc:creator>Jeff_Traigle</dc:creator>
      <dc:date>2006-04-20T08:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: Script help – record all files deleted by the script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-record-all-files-deleted-by-the-script/m-p/3774706#M261934</link>
      <description>YOu can also add a '-print' to your find command to have it print the file names.&lt;BR /&gt;&lt;BR /&gt;find $1 -mtime +$2 -print -exec rm -rf {} \;</description>
      <pubDate>Thu, 20 Apr 2006 08:22:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-record-all-files-deleted-by-the-script/m-p/3774706#M261934</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2006-04-20T08:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: Script help – record all files deleted by the script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-record-all-files-deleted-by-the-script/m-p/3774707#M261935</link>
      <description>Use tee:&lt;BR /&gt;LOG=/tmp/yourlogfile&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;find $1 -mtime +$2 -print -exec rm -rf {} \; |tee $LOG &lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 20 Apr 2006 08:33:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-record-all-files-deleted-by-the-script/m-p/3774707#M261935</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2006-04-20T08:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Script help – record all files deleted by the script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-record-all-files-deleted-by-the-script/m-p/3774708#M261936</link>
      <description>Hi Gulam:&lt;BR /&gt;&lt;BR /&gt;Another way is this:&lt;BR /&gt;&lt;BR /&gt;# find &lt;PATCH&gt; -xdev -type f -mtime +$2 | xargs -t rm -rf&lt;BR /&gt;&lt;BR /&gt;The 'xargs -t' enables tracing of the command that is executed.  Even more importantly, it bundles multiple file arguments to 'rm'.  This eliminates a 1:1 number of execs of a separate 'rm' for every argument found by 'find'.  Process creation is very, very expensive.  Using 'xargs' in lieu of '-exec' with 'find' will greatly improve performance.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;/PATCH&gt;</description>
      <pubDate>Thu, 20 Apr 2006 08:35:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-record-all-files-deleted-by-the-script/m-p/3774708#M261936</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-04-20T08:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: Script help – record all files deleted by the script.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-record-all-files-deleted-by-the-script/m-p/3774709#M261937</link>
      <description>Hi Gulam,&lt;BR /&gt;you can use this way:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;function purge_logs&lt;BR /&gt;{&lt;BR /&gt;find $1 -mtime +$2 -exec rm -rf {} \;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;{&lt;BR /&gt;purge_logs /psoft/hrcat88a/LOGS 30&lt;BR /&gt;purge_logs /psoft/hrcat88b/LOGS 60&lt;BR /&gt;purge_logs /psoft/hrcat88c/LOGS 90&lt;BR /&gt;} &amp;gt;logfile 2&amp;gt;&amp;amp;1&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;Thsi will write inti logfile all the output, including errors, comining from the 2 purge_logs.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 21 Apr 2006 03:06:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-record-all-files-deleted-by-the-script/m-p/3774709#M261937</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2006-04-21T03:06:15Z</dc:date>
    </item>
  </channel>
</rss>

