<?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 to remove files each day in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915718#M933902</link>
    <description>Bob,&lt;BR /&gt;&lt;BR /&gt;A simple find command should probably do it.  Something along these lines:&lt;BR /&gt;&lt;BR /&gt;01 01 * * 01 /usr/bin/find /tmp -type f -name TEST* -mtime +10 -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;You can modify the name parameter to suit your needs (like *.REP or whatever) and the mtime (last modifed time) may or may not be useful for you.  And, of course, you should change the /tmp to the location you need.&lt;BR /&gt;&lt;BR /&gt;Pete</description>
    <pubDate>Fri, 28 Feb 2003 12:40:52 GMT</pubDate>
    <dc:creator>Pete Randall</dc:creator>
    <dc:date>2003-02-28T12:40:52Z</dc:date>
    <item>
      <title>script to remove files each day</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915717#M933901</link>
      <description>Everyday I have to clear about 10 files from a directory. the files are always prefixed with four letters (always the same) then 6 numbers been the date sent to the directory. this is followed by .REP&lt;BR /&gt;so they look like this TEST280203.REP&lt;BR /&gt;&lt;BR /&gt;I intend to write a script to add to a contrab which will remove these for me.&lt;BR /&gt;at the moment I have to keep typing...&lt;BR /&gt;rm TEST280203.REP ABCD280203.REP DING280203.REP and so on!&lt;BR /&gt;&lt;BR /&gt;can anyone suggest a solution please.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;bob</description>
      <pubDate>Fri, 28 Feb 2003 12:35:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915717#M933901</guid>
      <dc:creator>bob the spod</dc:creator>
      <dc:date>2003-02-28T12:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove files each day</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915718#M933902</link>
      <description>Bob,&lt;BR /&gt;&lt;BR /&gt;A simple find command should probably do it.  Something along these lines:&lt;BR /&gt;&lt;BR /&gt;01 01 * * 01 /usr/bin/find /tmp -type f -name TEST* -mtime +10 -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;You can modify the name parameter to suit your needs (like *.REP or whatever) and the mtime (last modifed time) may or may not be useful for you.  And, of course, you should change the /tmp to the location you need.&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 28 Feb 2003 12:40:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915718#M933902</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-02-28T12:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove files each day</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915719#M933903</link>
      <description>thanks peter&lt;BR /&gt;if I didnt want to search all directories (i'm presuming thats what /usr/bin/find does)&lt;BR /&gt;what would you suggest.&lt;BR /&gt;I only want my script to point at one directory.&lt;BR /&gt;toptip about modifying the time &lt;BR /&gt;(im very new to all of this could you break down what each part does for me please)&lt;BR /&gt;thanks again&lt;BR /&gt;bob</description>
      <pubDate>Fri, 28 Feb 2003 12:52:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915719#M933903</guid>
      <dc:creator>bob the spod</dc:creator>
      <dc:date>2003-02-28T12:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove files each day</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915720#M933904</link>
      <description>Hi Bob,&lt;BR /&gt;&lt;BR /&gt;% cd yourdirectory&lt;BR /&gt;% ls | grep -E '^[A-Z]{4}[0-9]{6}\.REP' |xargs rm&lt;BR /&gt;&lt;BR /&gt;the regular expression matches:&lt;BR /&gt;&lt;BR /&gt;4 A-Z characters followed by:&lt;BR /&gt;6 numbers followed by:&lt;BR /&gt;.REP&lt;BR /&gt;&lt;BR /&gt;or using classes:&lt;BR /&gt;&lt;BR /&gt;% ls | grep -E '^[[:alpha:]]{4}[[:digit:]]{6}\.REP' |xargs rm&lt;BR /&gt;&lt;BR /&gt;rgds, Robin</description>
      <pubDate>Fri, 28 Feb 2003 12:53:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915720#M933904</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2003-02-28T12:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove files each day</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915721#M933905</link>
      <description>Bob,&lt;BR /&gt;&lt;BR /&gt;In the example I gave you, just change /tmp to the name of the directory you want to start in, like this:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;find /home/bob -type f -name *.REP -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;The "01 01 * * 01" is the syntax for crontab which says at 1 minute after 1AM, on any day of the month, in any month, on the first day of the week (Monday).  The rest of it  translates thusly:  "/home/bob" is the starting point for the search.  "-type f" says we're just looking for files.  "-name *.REP" says the file needs to be named anything as long as the name ends in "REP".  "-exec rm {} \;" says remove it.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 28 Feb 2003 13:04:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915721#M933905</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-02-28T13:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove files each day</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915722#M933906</link>
      <description>Bob -&lt;BR /&gt;Attached is a small script used to clean up our /tmp directory daily.&lt;BR /&gt;This can be modified for your purposes of rhe .REP files only.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;dl</description>
      <pubDate>Fri, 28 Feb 2003 15:04:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915722#M933906</guid>
      <dc:creator>Dave La Mar</dc:creator>
      <dc:date>2003-02-28T15:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove files each day</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915723#M933907</link>
      <description>Pete&lt;BR /&gt;I like your last option v much indeed and am going to use it &lt;BR /&gt;However I cannot use the *.REP part of it due to some files which I receive are required.&lt;BR /&gt;&lt;BR /&gt;if I specify the front part of the filename would that work (like this)&lt;BR /&gt;&lt;BR /&gt;find /tmp/bob -type f -name ABCD* FACE* HIDE* FOUR* GOLF* POLO* WORD* -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;would the above remove files like the below&lt;BR /&gt;ABCD280203.REP&lt;BR /&gt;FACE280203.REP&lt;BR /&gt;HIDE280203.REP&lt;BR /&gt;FOUR280203.REP&lt;BR /&gt;GOLF280203.REP&lt;BR /&gt;&lt;BR /&gt;or is this unlikely to work?</description>
      <pubDate>Fri, 28 Feb 2003 15:21:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915723#M933907</guid>
      <dc:creator>bob the spod</dc:creator>
      <dc:date>2003-02-28T15:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove files each day</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915724#M933908</link>
      <description>Bob,&lt;BR /&gt;&lt;BR /&gt;find /tmp/bob -type f \( -name ABCD* -o -name ABCD* -o -name FACE* -o -name HIDE* -o -name FOUR* -o -name GOLF* -o -name POLO* -o -name WORD* \) -exec rm {} \; &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;That should do it!  Test it by substituting an ls command in place of the rm:&lt;BR /&gt;&lt;BR /&gt;find /tmp/bob -type f \( -name ABCD* -o -name ABCD* -o -name FACE* -o -name HIDE* -o -name FOUR* -o -name GOLF* -o -name POLO* -o -name WORD* \) -exec ls {} \; &lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 28 Feb 2003 15:27:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915724#M933908</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-02-28T15:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove files each day</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915725#M933909</link>
      <description>pete&lt;BR /&gt;Ive tried that exact code below, where will the list appear???&lt;BR /&gt;&lt;BR /&gt;10 16 * * * find /stage/intray -type f \( -name FUPD* -o -name TSFA* -o -name ESFA* -o -name FCOV* -o -name FCMV* -o -na&lt;BR /&gt;me FCGV* -o -name FCVV* \) -exec ls {} \;&lt;BR /&gt;thanks &lt;BR /&gt;bob</description>
      <pubDate>Fri, 28 Feb 2003 16:03:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915725#M933909</guid>
      <dc:creator>bob the spod</dc:creator>
      <dc:date>2003-02-28T16:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove files each day</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915726#M933910</link>
      <description>Bob,&lt;BR /&gt;&lt;BR /&gt;For testing purposes, don't submit it to cron, just do the find from the command line.  When you do use cron the output is emailed to the submitting user.&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 28 Feb 2003 16:07:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915726#M933910</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-02-28T16:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove files each day</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915727#M933911</link>
      <description>The problem is that you are not quoting your -name arguments. ABCD* should be 'ABCD*'. You want find to do the expansion NOT the shell.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 28 Feb 2003 16:07:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915727#M933911</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-02-28T16:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: script to remove files each day</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915728#M933912</link>
      <description>Thanks, Clay!  The quotes got lost somewhere in the cut and paste process and I never even noticed.&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 28 Feb 2003 16:09:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-remove-files-each-day/m-p/2915728#M933912</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-02-28T16:09:36Z</dc:date>
    </item>
  </channel>
</rss>

