<?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: deletion of files in single stroke in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463185#M849005</link>
    <description>Oops .. I should have used "egrep" instead of&lt;BR /&gt;"grep" in my previous message.&lt;BR /&gt;&lt;BR /&gt;$ ls -1 | egrep "nov|dec" | xargs rm -rf&lt;BR /&gt;&lt;BR /&gt;Since egrep is going to be obsolete soon, you &lt;BR /&gt;can do the same thing using "grep":&lt;BR /&gt;&lt;BR /&gt;$ ls -1 | grep -e nov -e dec | xargs rm -rf &lt;BR /&gt;&lt;BR /&gt;- Biswajit&lt;BR /&gt;</description>
    <pubDate>Fri, 14 Jan 2005 02:03:22 GMT</pubDate>
    <dc:creator>Biswajit Tripathy</dc:creator>
    <dc:date>2005-01-14T02:03:22Z</dc:date>
    <item>
      <title>deletion of files in single stroke</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463182#M849002</link>
      <description>Hello gurus,&lt;BR /&gt;i have a directory wherein system puts thousands of files everyday ..now i have above 5000 files in that directory containing files of 'nov','dec','jan'...&lt;BR /&gt;currently we are facing space problem...&lt;BR /&gt;so&lt;BR /&gt;can anyone tell me how can i delete files of 'nov' &amp;amp; 'dec' in a single stroke ?&lt;BR /&gt;&lt;BR /&gt;i thought of following:&lt;BR /&gt;for file in `ls -lrt|grep 'dec'|awk '{print $9}'`&lt;BR /&gt;do&lt;BR /&gt;rm -fr $file&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;is this correct?&lt;BR /&gt;&lt;BR /&gt;Will find command be of any help? if yes,how?&lt;BR /&gt;&lt;BR /&gt;thanks all,&lt;BR /&gt;regards&lt;BR /&gt;&lt;BR /&gt;ABHI k</description>
      <pubDate>Fri, 14 Jan 2005 00:53:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463182#M849002</guid>
      <dc:creator>abhijeet_7</dc:creator>
      <dc:date>2005-01-14T00:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: deletion of files in single stroke</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463183#M849003</link>
      <description>hi ABHI &lt;BR /&gt;&lt;BR /&gt;you might want to use the find command: &lt;BR /&gt;first see which files you select with: &lt;BR /&gt;# find /dirname -mtime +12 -exec ll {} \;&lt;BR /&gt;&lt;BR /&gt;where you select all files modified 12 days ago or more&lt;BR /&gt;and display them.&lt;BR /&gt;&lt;BR /&gt;if oke&lt;BR /&gt;&lt;BR /&gt;then use&lt;BR /&gt;# find /dirname -mtime +12 -exec rm  {} \;&lt;BR /&gt;&lt;BR /&gt;for removal&lt;BR /&gt;&lt;BR /&gt;good luck.&lt;BR /&gt;Henk</description>
      <pubDate>Fri, 14 Jan 2005 01:39:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463183#M849003</guid>
      <dc:creator>Henk Geurts</dc:creator>
      <dc:date>2005-01-14T01:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: deletion of files in single stroke</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463184#M849004</link>
      <description>If all files are in 1 directory, then:&lt;BR /&gt;&lt;BR /&gt;$ ls -1 | grep "nov|dec" | xargs rm -rf&lt;BR /&gt;&lt;BR /&gt;- Biswajit&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Jan 2005 01:48:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463184#M849004</guid>
      <dc:creator>Biswajit Tripathy</dc:creator>
      <dc:date>2005-01-14T01:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: deletion of files in single stroke</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463185#M849005</link>
      <description>Oops .. I should have used "egrep" instead of&lt;BR /&gt;"grep" in my previous message.&lt;BR /&gt;&lt;BR /&gt;$ ls -1 | egrep "nov|dec" | xargs rm -rf&lt;BR /&gt;&lt;BR /&gt;Since egrep is going to be obsolete soon, you &lt;BR /&gt;can do the same thing using "grep":&lt;BR /&gt;&lt;BR /&gt;$ ls -1 | grep -e nov -e dec | xargs rm -rf &lt;BR /&gt;&lt;BR /&gt;- Biswajit&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Jan 2005 02:03:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463185#M849005</guid>
      <dc:creator>Biswajit Tripathy</dc:creator>
      <dc:date>2005-01-14T02:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: deletion of files in single stroke</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463186#M849006</link>
      <description>Hi Henk,&lt;BR /&gt;thanks for the suggestion,&lt;BR /&gt;but i don't want to check the access/modify peroid while deleting the these files.&lt;BR /&gt;&lt;BR /&gt;i must delete them,only problem is that the &lt;BR /&gt;count is huge( above 5000)...&lt;BR /&gt;&lt;BR /&gt;i must preserve the files for "january"..&lt;BR /&gt;but i need to delete "nov" ,"dec" files..&lt;BR /&gt;&lt;BR /&gt;any comments on the 'for' loop?&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;ABHI K</description>
      <pubDate>Fri, 14 Jan 2005 02:03:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463186#M849006</guid>
      <dc:creator>abhijeet_7</dc:creator>
      <dc:date>2005-01-14T02:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: deletion of files in single stroke</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463187#M849007</link>
      <description>ABHI &lt;BR /&gt;&lt;BR /&gt;the loop looks fine but it removes not only &lt;BR /&gt;&lt;BR /&gt;-r--r--r--   1 root       sys           4585 dec 13 23:59 syslog.log.13-dec-04&lt;BR /&gt;but also the files of recent date with nov/dec in the name : &lt;BR /&gt;-r--r--r--   1 root       sys            963 jan 13 23:59 deco.log.13-jan-05&lt;BR /&gt;&lt;BR /&gt;so be carefull.&lt;BR /&gt;&lt;BR /&gt;regards.</description>
      <pubDate>Fri, 14 Jan 2005 02:40:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463187#M849007</guid>
      <dc:creator>Henk Geurts</dc:creator>
      <dc:date>2005-01-14T02:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: deletion of files in single stroke</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463188#M849008</link>
      <description>Hi,&lt;BR /&gt;the problem with deleting huge number of files only gives a problem if you exceed the max length for the command.&lt;BR /&gt;So your approach with a loop is correct as it only deletes one file in each pass.&lt;BR /&gt;If you have a certain filename format, wou may want to limit your ls -1 with wildcards.</description>
      <pubDate>Fri, 14 Jan 2005 02:56:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463188#M849008</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2005-01-14T02:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: deletion of files in single stroke</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463189#M849009</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;you can avoid deleting files which contain dec in the name with&lt;BR /&gt;grep '_dec_'&lt;BR /&gt;_ is blank&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Jan 2005 04:13:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463189#M849009</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2005-01-14T04:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: deletion of files in single stroke</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463190#M849010</link>
      <description>Have you considered compressing your files as opposed to deleting them?  &lt;BR /&gt;for FILE in `ls -1 *Nov*`&lt;BR /&gt;do&lt;BR /&gt;echo $FILE&lt;BR /&gt;gzip $FILE&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Fri, 14 Jan 2005 09:55:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463190#M849010</guid>
      <dc:creator>Chris Vail</dc:creator>
      <dc:date>2005-01-14T09:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: deletion of files in single stroke</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463191#M849011</link>
      <description>hi,&lt;BR /&gt;i too think that find would be the better way.&lt;BR /&gt;Anyway if you want a loop in order to choose in some strange way, eg. deleting all files except March and June, I suggest you to avoid building a long argument list as in ur example, instead use a pipeline.&lt;BR /&gt;&lt;BR /&gt;To do that find a command that write on stdout the names you want to delete and pipe this command with:&lt;BR /&gt;while read fname; do rm -f $fname; done&lt;BR /&gt;&lt;BR /&gt;for instance&lt;BR /&gt;&lt;BR /&gt;ll | awk '$6 != "Mar" &amp;amp;&amp;amp; $6 != "Jun" {print $9}' | while read fname; do rm -f $fname; done&lt;BR /&gt;&lt;BR /&gt;the awk should (check it please) print names of files with date not in March or June, the while loops for all this names using one for every loop and so avoiding the possible problem of having too much args on command line&lt;BR /&gt;&lt;BR /&gt;hope it helps&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Jan 2005 10:22:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463191#M849011</guid>
      <dc:creator>Cesare Salvioni</dc:creator>
      <dc:date>2005-01-14T10:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: deletion of files in single stroke</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463192#M849012</link>
      <description>To get around the problem that Henk pointed out, try this:&lt;BR /&gt;&lt;BR /&gt;for file in *-dec-*&lt;BR /&gt;do&lt;BR /&gt;rm -f $file&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Jan 2005 09:32:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/deletion-of-files-in-single-stroke/m-p/3463192#M849012</guid>
      <dc:creator>Gordon  Morrison</dc:creator>
      <dc:date>2005-01-19T09:32:31Z</dc:date>
    </item>
  </channel>
</rss>

