<?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 delete outdated files in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074290#M719366</link>
    <description>Sorry, I haven't considdered the filtering of proper mtimes.&lt;BR /&gt;But this should be easy to insert in the grep() call.</description>
    <pubDate>Thu, 18 Sep 2003 15:42:59 GMT</pubDate>
    <dc:creator>Ralph Grothe</dc:creator>
    <dc:date>2003-09-18T15:42:59Z</dc:date>
    <item>
      <title>Script to delete outdated files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074270#M719346</link>
      <description>I want to write a script to examine the files in a directory (non-recursively) and delete the ones over x days old.  How do I perform the date comparison?&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Sep 2003 13:07:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074270#M719346</guid>
      <dc:creator>Ed Hon</dc:creator>
      <dc:date>2003-09-18T13:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: Script to delete outdated files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074271#M719347</link>
      <description>use the find command, it does the date comparison for you;&lt;BR /&gt;&lt;BR /&gt;cd &lt;DIR&gt;&lt;BR /&gt;find . -mtime +7 -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;This will delete all files in this dir older than 7 days.&lt;BR /&gt;&lt;/DIR&gt;</description>
      <pubDate>Thu, 18 Sep 2003 13:11:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074271#M719347</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2003-09-18T13:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: Script to delete outdated files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074272#M719348</link>
      <description>I was going to suggest they find command as well but I'm not sure how to make it non-recursive which I assume to mean that you don't want to traverse underlying subdirectories.  I assume you'll have to write a script using Clays caljd.sh to do date comparisons.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Sep 2003 13:14:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074272#M719348</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-09-18T13:14:57Z</dc:date>
    </item>
    <item>
      <title>Re: Script to delete outdated files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074273#M719349</link>
      <description>Hi Ed,&lt;BR /&gt;&lt;BR /&gt;To do the find nonrecursively add &lt;BR /&gt;! -depth&lt;BR /&gt;So Stefan's command would be&lt;BR /&gt;&lt;BR /&gt;find . ! -depth -mtime +7 -exec rm -i {} \;&lt;BR /&gt;&lt;BR /&gt;Note I added the -i to rm to have it query you just in case you find files you wish to retain.&lt;BR /&gt;If it's a long list &amp;amp; you don't want answer Y/N to them all then just replace rm with ll to get a listing &amp;amp; remove the -i&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Jeff</description>
      <pubDate>Thu, 18 Sep 2003 13:19:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074273#M719349</guid>
      <dc:creator>Jeff Schussele</dc:creator>
      <dc:date>2003-09-18T13:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: Script to delete outdated files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074274#M719350</link>
      <description>(duh!! - thanks, Jeff!)</description>
      <pubDate>Thu, 18 Sep 2003 13:21:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074274#M719350</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-09-18T13:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: Script to delete outdated files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074275#M719351</link>
      <description>If you don't want to recurse, does it mean you'd simply want to stat files in the selected directory?&lt;BR /&gt;Sorry, for my silly question but English isn't my native tongue.&lt;BR /&gt;&lt;BR /&gt;If so then I doubt that the suggested  "! -depth" will work.&lt;BR /&gt;Instead you should use find's -prune switch.&lt;BR /&gt;But I guess fiddling together an appropiate -prune logic will be more cumbersome than putting together a few lines of Perl (or even C if you prefer) that simply use the syscalls opendir() and readdir().&lt;BR /&gt;&lt;BR /&gt;If you don't want to engulf submounts in the find you'd have to use the -xdev switch.</description>
      <pubDate>Thu, 18 Sep 2003 13:57:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074275#M719351</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2003-09-18T13:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: Script to delete outdated files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074276#M719352</link>
      <description>I stand corrected -   -prune it is.&lt;BR /&gt;Good catch Ralph.&lt;BR /&gt;&lt;BR /&gt;Rgds,&lt;BR /&gt;Jeff</description>
      <pubDate>Thu, 18 Sep 2003 14:06:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074276#M719352</guid>
      <dc:creator>Jeff Schussele</dc:creator>
      <dc:date>2003-09-18T14:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: Script to delete outdated files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074277#M719353</link>
      <description>Jeff,&lt;BR /&gt;&lt;BR /&gt;If cd to /dumpdat1 and do&lt;BR /&gt;&lt;BR /&gt;find . -depth -mtime +3&lt;BR /&gt;&lt;BR /&gt;I get as output several lines with file names in /dumpdat1, but if I do&lt;BR /&gt;&lt;BR /&gt;find . ! -depth -mtime +3&lt;BR /&gt;&lt;BR /&gt;all my output disappears.&lt;BR /&gt;&lt;BR /&gt;Ed</description>
      <pubDate>Thu, 18 Sep 2003 14:33:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074277#M719353</guid>
      <dc:creator>Ed Hon</dc:creator>
      <dc:date>2003-09-18T14:33:12Z</dc:date>
    </item>
    <item>
      <title>Re: Script to delete outdated files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074278#M719354</link>
      <description>find . -prune -mtime +3&lt;BR /&gt;find . ! -prune -mtime +3&lt;BR /&gt;&lt;BR /&gt;Either gives me no output.&lt;BR /&gt;&lt;BR /&gt;Ed</description>
      <pubDate>Thu, 18 Sep 2003 14:38:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074278#M719354</guid>
      <dc:creator>Ed Hon</dc:creator>
      <dc:date>2003-09-18T14:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Script to delete outdated files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074279#M719355</link>
      <description>Hi,&lt;BR /&gt;try&lt;BR /&gt;&lt;BR /&gt;find . -mtime +7 -print |while read a&lt;BR /&gt;do&lt;BR /&gt;if  [ $(dirname $a) = "." ]&lt;BR /&gt;then&lt;BR /&gt;rm $a&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Sep 2003 14:47:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074279#M719355</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2003-09-18T14:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: Script to delete outdated files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074280#M719356</link>
      <description>sorry, the format for find to delete files ONLY in the current dir is;&lt;BR /&gt;&lt;BR /&gt;find . \( -type d ! -name . -prune \) -o \( -type f -mtime +7 ! -name "." -print \) -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;Try it, works fine.&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Sep 2003 14:55:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074280#M719356</guid>
      <dc:creator>Stefan Farrelly</dc:creator>
      <dc:date>2003-09-18T14:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: Script to delete outdated files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074281#M719357</link>
      <description>Ed,&lt;BR /&gt;&lt;BR /&gt;Your syntax is wrong... mtime should come first. refer to the man page also for full syntax&lt;BR /&gt;&lt;BR /&gt;YES:&lt;BR /&gt;find . -mtime +3 -prune&lt;BR /&gt;&lt;BR /&gt;NO:&lt;BR /&gt;find . -prune -mtime +3&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Sep 2003 15:34:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074281#M719357</guid>
      <dc:creator>Todd McDaniel_1</dc:creator>
      <dc:date>2003-09-18T15:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Script to delete outdated files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074282#M719358</link>
      <description>Ed,&lt;BR /&gt;&lt;BR /&gt;Your syntax is wrong... mtime should come first. refer to the man page also for full syntax&lt;BR /&gt;&lt;BR /&gt;YES:&lt;BR /&gt;find . -mtime +3 -prune&lt;BR /&gt;&lt;BR /&gt;NO:&lt;BR /&gt;find . -prune -mtime +3&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Sep 2003 15:34:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074282#M719358</guid>
      <dc:creator>Todd McDaniel_1</dc:creator>
      <dc:date>2003-09-18T15:34:54Z</dc:date>
    </item>
    <item>
      <title>Re: Script to delete outdated files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074283#M719359</link>
      <description>Ed,&lt;BR /&gt;&lt;BR /&gt;Your syntax is wrong... mtime should come first. refer to the man page also for full syntax&lt;BR /&gt;&lt;BR /&gt;YES:&lt;BR /&gt;find . -mtime +3 -prune&lt;BR /&gt;&lt;BR /&gt;NO:&lt;BR /&gt;find . -prune -mtime +3&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Sep 2003 15:34:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074283#M719359</guid>
      <dc:creator>Todd McDaniel_1</dc:creator>
      <dc:date>2003-09-18T15:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: Script to delete outdated files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074284#M719360</link>
      <description>Ed,&lt;BR /&gt;&lt;BR /&gt;Your syntax is wrong... mtime should come first. refer to the man page also for full syntax&lt;BR /&gt;&lt;BR /&gt;YES:&lt;BR /&gt;find . -mtime +3 -prune&lt;BR /&gt;&lt;BR /&gt;NO:&lt;BR /&gt;find . -prune -mtime +3&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Sep 2003 15:35:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074284#M719360</guid>
      <dc:creator>Todd McDaniel_1</dc:creator>
      <dc:date>2003-09-18T15:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Script to delete outdated files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074285#M719361</link>
      <description>Ed,&lt;BR /&gt;&lt;BR /&gt;Your syntax is wrong... mtime should come first. refer to the man page also for full syntax&lt;BR /&gt;&lt;BR /&gt;YES:&lt;BR /&gt;find . -mtime +3 -prune&lt;BR /&gt;&lt;BR /&gt;NO:&lt;BR /&gt;find . -prune -mtime +3&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Sep 2003 15:35:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074285#M719361</guid>
      <dc:creator>Todd McDaniel_1</dc:creator>
      <dc:date>2003-09-18T15:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Script to delete outdated files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074286#M719362</link>
      <description>Ed,&lt;BR /&gt;&lt;BR /&gt;Your syntax is wrong... mtime should come first. refer to the man page also for full syntax&lt;BR /&gt;&lt;BR /&gt;YES:&lt;BR /&gt;find . -mtime +3 -prune&lt;BR /&gt;&lt;BR /&gt;NO:&lt;BR /&gt;find . -prune -mtime +3&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Sep 2003 15:35:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074286#M719362</guid>
      <dc:creator>Todd McDaniel_1</dc:creator>
      <dc:date>2003-09-18T15:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: Script to delete outdated files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074287#M719363</link>
      <description>Ed,&lt;BR /&gt;&lt;BR /&gt;Your syntax is wrong... mtime should come first. refer to the man page also for full syntax&lt;BR /&gt;&lt;BR /&gt;YES:&lt;BR /&gt;find . -mtime +3 -prune&lt;BR /&gt;&lt;BR /&gt;NO:&lt;BR /&gt;find . -prune -mtime +3&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Sep 2003 15:35:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074287#M719363</guid>
      <dc:creator>Todd McDaniel_1</dc:creator>
      <dc:date>2003-09-18T15:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: Script to delete outdated files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074288#M719364</link>
      <description>Ed,&lt;BR /&gt;&lt;BR /&gt;Your syntax is wrong... mtime should come first. refer to the man page also for full syntax&lt;BR /&gt;&lt;BR /&gt;YES:&lt;BR /&gt;find . -mtime +3 -prune&lt;BR /&gt;&lt;BR /&gt;NO:&lt;BR /&gt;find . -prune -mtime +3&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Sep 2003 15:35:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074288#M719364</guid>
      <dc:creator>Todd McDaniel_1</dc:creator>
      <dc:date>2003-09-18T15:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: Script to delete outdated files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074289#M719365</link>
      <description>See Stefan, that's what I meant.&lt;BR /&gt;The usage of -prune switches soon becomes quite nasty, especially when you have to quote all those parantheses to protect from the shell.&lt;BR /&gt;That's why I'd prefer something Perlish like&lt;BR /&gt;&lt;BR /&gt;e.g.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;opendir DH, '/tmp' or die "opendir failed: $!\n";&lt;BR /&gt;@files = grep {! -d "/var/$_"} grep !/^[.]{1,2}$/, readdir DH;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Now if you're a hot shot you could do something like&lt;BR /&gt;&lt;BR /&gt;unlink map("/tmp/$_", @files);</description>
      <pubDate>Thu, 18 Sep 2003 15:40:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-delete-outdated-files/m-p/3074289#M719365</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2003-09-18T15:40:46Z</dc:date>
    </item>
  </channel>
</rss>

