<?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 all files except a file generated latest in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/remove-all-files-except-a-file-generated-latest/m-p/3767677#M101987</link>
    <description>last_file=$(ls -1tr|tail -1)&lt;BR /&gt;echo "Removing all others files now"&lt;BR /&gt;find . -type f ! -name "${last_file}" -exec ll -d {} \;&lt;BR /&gt;ll ${last_file}&lt;BR /&gt;&lt;BR /&gt;Check this first and then replce -exec ll -d {} with -exec rm {}</description>
    <pubDate>Thu, 06 Apr 2006 22:57:12 GMT</pubDate>
    <dc:creator>RAC_1</dc:creator>
    <dc:date>2006-04-06T22:57:12Z</dc:date>
    <item>
      <title>Remove all files except a file generated latest</title>
      <link>https://community.hpe.com/t5/operating-system-linux/remove-all-files-except-a-file-generated-latest/m-p/3767676#M101986</link>
      <description>Hi all.&lt;BR /&gt;It's been a nice day.&lt;BR /&gt;&lt;BR /&gt;it is very sticky problem. can you give tips?&lt;BR /&gt;I'm going to remove oracle archive log file  but generated lastet log file before file system is going to be full.&lt;BR /&gt;&lt;BR /&gt;I'm going to post shell prg related job above,&lt;BR /&gt;and give me the solution which is fit for that job.&lt;BR /&gt;&lt;BR /&gt;*Shell #1&lt;BR /&gt;&lt;BR /&gt;#DELETING ARCHIVE LOG.&lt;BR /&gt;df -k &amp;gt; c&lt;BR /&gt;value=`awk '/\/arch_ispbs/ {print $3}' c`&lt;BR /&gt;str=`ps -e|grep save|awk '{print $4}'`&lt;BR /&gt;if [ $value -gt 4242880 -a -z "$str" ]; then&lt;BR /&gt;        (/usr/bin/sh /d) &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;fi&lt;BR /&gt;============================================&lt;BR /&gt;*Shell #2&lt;BR /&gt;&lt;BR /&gt;touch /arch_ispbs/temp&lt;BR /&gt;save -s online -b oracle -l full /arch_ispbs&lt;BR /&gt;find /arch_ispbs ! -newer /arch_ispbs/temp |xargs rm</description>
      <pubDate>Thu, 06 Apr 2006 21:25:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/remove-all-files-except-a-file-generated-latest/m-p/3767676#M101986</guid>
      <dc:creator>file system</dc:creator>
      <dc:date>2006-04-06T21:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all files except a file generated latest</title>
      <link>https://community.hpe.com/t5/operating-system-linux/remove-all-files-except-a-file-generated-latest/m-p/3767677#M101987</link>
      <description>last_file=$(ls -1tr|tail -1)&lt;BR /&gt;echo "Removing all others files now"&lt;BR /&gt;find . -type f ! -name "${last_file}" -exec ll -d {} \;&lt;BR /&gt;ll ${last_file}&lt;BR /&gt;&lt;BR /&gt;Check this first and then replce -exec ll -d {} with -exec rm {}</description>
      <pubDate>Thu, 06 Apr 2006 22:57:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/remove-all-files-except-a-file-generated-latest/m-p/3767677#M101987</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2006-04-06T22:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all files except a file generated latest</title>
      <link>https://community.hpe.com/t5/operating-system-linux/remove-all-files-except-a-file-generated-latest/m-p/3767678#M101988</link>
      <description>Thank you RAC .&lt;BR /&gt;I got your help and, editted the shell progrm like this.&lt;BR /&gt;&lt;BR /&gt;#1. Save file before remove all file.&lt;BR /&gt;save -s online -b oracle -l full /arch_ispbs&lt;BR /&gt;&lt;BR /&gt;#2. Generate latest file&lt;BR /&gt;last_file=`find /arch_ispbs |ls -1|tail -1`&lt;BR /&gt;&lt;BR /&gt;#3. And then remove except latest file had above line&lt;BR /&gt;&lt;BR /&gt;find /arch_ispbs  ! -name $last_file|xargs rm&lt;BR /&gt;&lt;BR /&gt;Owe to you, I have glad morning. Thank you</description>
      <pubDate>Sun, 09 Apr 2006 20:16:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/remove-all-files-except-a-file-generated-latest/m-p/3767678#M101988</guid>
      <dc:creator>file system</dc:creator>
      <dc:date>2006-04-09T20:16:24Z</dc:date>
    </item>
  </channel>
</rss>

