<?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 Any help for this script appreciated in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/any-help-for-this-script-appreciated/m-p/3577578#M702849</link>
    <description>This the script to delete files older than 240 days.&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;find /tmp  -mtime +240 -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;Here i have to pass the days value interactively. please help me to solve this.&lt;BR /&gt;&lt;BR /&gt;Rajesh</description>
    <pubDate>Wed, 06 Jul 2005 21:16:01 GMT</pubDate>
    <dc:creator>KRS_1</dc:creator>
    <dc:date>2005-07-06T21:16:01Z</dc:date>
    <item>
      <title>Any help for this script appreciated</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/any-help-for-this-script-appreciated/m-p/3577578#M702849</link>
      <description>This the script to delete files older than 240 days.&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;find /tmp  -mtime +240 -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;Here i have to pass the days value interactively. please help me to solve this.&lt;BR /&gt;&lt;BR /&gt;Rajesh</description>
      <pubDate>Wed, 06 Jul 2005 21:16:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/any-help-for-this-script-appreciated/m-p/3577578#M702849</guid>
      <dc:creator>KRS_1</dc:creator>
      <dc:date>2005-07-06T21:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Any help for this script appreciated</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/any-help-for-this-script-appreciated/m-p/3577579#M702850</link>
      <description>Hi Rajesh,&lt;BR /&gt;&lt;BR /&gt;I am not an expert in scripting but it should work.&lt;BR /&gt;===========================================&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;read var1&lt;BR /&gt;echo $var1&lt;BR /&gt;find /tmp -mtime +$var1 -exec rm {} \;&lt;BR /&gt;exit&lt;BR /&gt;===========================================&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Devender&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Jul 2005 21:43:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/any-help-for-this-script-appreciated/m-p/3577579#M702850</guid>
      <dc:creator>Devender Khatana</dc:creator>
      <dc:date>2005-07-06T21:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: Any help for this script appreciated</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/any-help-for-this-script-appreciated/m-p/3577580#M702851</link>
      <description>Rajesh,&lt;BR /&gt;I think what Devender has suggested should be fine. Since you have mentioned you want to pass the value interactively, here is a modification&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;echo "Please enter the number of days: \c"               &lt;BR /&gt;read var1&lt;BR /&gt;echo "files older than $var1 days will be deleted "&lt;BR /&gt;find /tmp -mtime +$var1 -exec rm {} \;&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;DP</description>
      <pubDate>Wed, 06 Jul 2005 22:40:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/any-help-for-this-script-appreciated/m-p/3577580#M702851</guid>
      <dc:creator>Devesh Pant_1</dc:creator>
      <dc:date>2005-07-06T22:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: Any help for this script appreciated</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/any-help-for-this-script-appreciated/m-p/3577581#M702852</link>
      <description>I would actually go one step further:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;echo "Please enter the age of files you want to delete in days:"&lt;BR /&gt;read DAYS&lt;BR /&gt;&lt;BR /&gt;find /tmp -mtime +${DAYS} -type f -exec ls -ld {} \;&lt;BR /&gt;&lt;BR /&gt;echo "Are you sure you want to delete all of these files?"&lt;BR /&gt;&lt;BR /&gt;read ANSWER&lt;BR /&gt;&lt;BR /&gt;if [[ ${ANSWER} = "Y" -o ${ANSWER} = "y" ]] ; then&lt;BR /&gt;find /tmp -mtime +${DAYS} -type f -print -exec rm -f {} \;&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This script will first list the files you want to delete and then prompt you to make sure you want to delete them.  If you answer with anything other than Y or y, then it won't delete the files.</description>
      <pubDate>Wed, 06 Jul 2005 22:47:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/any-help-for-this-script-appreciated/m-p/3577581#M702852</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2005-07-06T22:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: Any help for this script appreciated</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/any-help-for-this-script-appreciated/m-p/3577582#M702853</link>
      <description>It looks like you need to pass many values.&lt;BR /&gt;That's why you need to pass them interactively.&lt;BR /&gt;&lt;BR /&gt;Just add a while loop in Patrick's script&lt;BR /&gt;&lt;BR /&gt;echo "Continue"&lt;BR /&gt;read choice&lt;BR /&gt;While ($choice='y')&lt;BR /&gt;  Patric's script&lt;BR /&gt;read choice&lt;BR /&gt;done</description>
      <pubDate>Wed, 06 Jul 2005 23:38:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/any-help-for-this-script-appreciated/m-p/3577582#M702853</guid>
      <dc:creator>Vibhor Kumar Agarwal</dc:creator>
      <dc:date>2005-07-06T23:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: Any help for this script appreciated</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/any-help-for-this-script-appreciated/m-p/3577583#M702854</link>
      <description>You can try by setting an environment variable as  #export FINDDAY=240&lt;BR /&gt;#find /tmp -mtime +${FINDDAY} -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;If you want to change it then, &lt;BR /&gt;&lt;BR /&gt;# export FINDDAY=100&lt;BR /&gt;&lt;BR /&gt;hth.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Jul 2005 23:57:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/any-help-for-this-script-appreciated/m-p/3577583#M702854</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-07-06T23:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: Any help for this script appreciated</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/any-help-for-this-script-appreciated/m-p/3577584#M702855</link>
      <description>My approach to this would not be asking the user or setting an environment variable but simply passing in the argument on the command line --- and like real UNIX applications, it assumes that the users knows what he is doing and doesn't ask confimation questions.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;PROG=${0}&lt;BR /&gt;typeset -i STAT=255&lt;BR /&gt;if [[ ${#} -ge 1 ]]&lt;BR /&gt;  then&lt;BR /&gt;    typeset -i DAYS=${1}&lt;BR /&gt;    shift&lt;BR /&gt;    find /tmp -mtime +${DAYS} -exec rm \;&lt;BR /&gt;    STAT=${?}&lt;BR /&gt;  else&lt;BR /&gt;    echo "Usage: ${PROG} requires 1 arg." &amp;gt;&amp;amp;2&lt;BR /&gt;  fi&lt;BR /&gt;exit ${STAT}&lt;BR /&gt;&lt;BR /&gt;You would use it like this:&lt;BR /&gt;myscript.sh 100&lt;BR /&gt;&lt;BR /&gt;If you like, you could write another little script that prompts for the value and then pass this value into myscript.sh.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 07 Jul 2005 08:49:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/any-help-for-this-script-appreciated/m-p/3577584#M702855</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-07-07T08:49:15Z</dc:date>
    </item>
  </channel>
</rss>

