<?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 need forums suggestions/expert opinion in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/need-forums-suggestions-expert-opinion/m-p/4372422#M61191</link>
    <description>there is a directory /tmp/bu-logs&lt;BR /&gt;&lt;BR /&gt;under /tmp/bu-logs directory there are following 5 directories&lt;BR /&gt;&lt;BR /&gt;# ls /tmp/bu-logs&lt;BR /&gt;maaz ron kjames rts adn riz&lt;BR /&gt;&lt;BR /&gt;inside maaz ron kjames rts adn riz there are directories for each day, e.g &lt;BR /&gt;&lt;BR /&gt;# ls /tmp/bu-logs/maaz/&lt;BR /&gt;01-03-09&lt;BR /&gt;02-03-09&lt;BR /&gt;03-03-09&lt;BR /&gt;04-03-09&lt;BR /&gt;05-03-09&lt;BR /&gt;etc&lt;BR /&gt;&lt;BR /&gt;each of the directory /tmp/bu-logs/maaz/01-03-09, contains some files&lt;BR /&gt;&lt;BR /&gt;now I  wrote a script that is suppose to deletes all those directories(under /tmp/bu-logs/maaz, /tmp/bu-logs/riz, etc) that are older than 30 days&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/bin/bash&lt;BR /&gt;cd /tmp/bu-logs&lt;BR /&gt;for i in maaz ron kjames rts adn riz&lt;BR /&gt;do&lt;BR /&gt;   find ./ -ctime +30 -exec rm -rf {} \; &lt;BR /&gt;done&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;will the above code work ?&lt;BR /&gt;is there any mistake ?&lt;BR /&gt;please share your comments/suggestion&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Maaz</description>
    <pubDate>Thu, 05 Mar 2009 12:28:31 GMT</pubDate>
    <dc:creator>Maaz</dc:creator>
    <dc:date>2009-03-05T12:28:31Z</dc:date>
    <item>
      <title>need forums suggestions/expert opinion</title>
      <link>https://community.hpe.com/t5/operating-system-linux/need-forums-suggestions-expert-opinion/m-p/4372422#M61191</link>
      <description>there is a directory /tmp/bu-logs&lt;BR /&gt;&lt;BR /&gt;under /tmp/bu-logs directory there are following 5 directories&lt;BR /&gt;&lt;BR /&gt;# ls /tmp/bu-logs&lt;BR /&gt;maaz ron kjames rts adn riz&lt;BR /&gt;&lt;BR /&gt;inside maaz ron kjames rts adn riz there are directories for each day, e.g &lt;BR /&gt;&lt;BR /&gt;# ls /tmp/bu-logs/maaz/&lt;BR /&gt;01-03-09&lt;BR /&gt;02-03-09&lt;BR /&gt;03-03-09&lt;BR /&gt;04-03-09&lt;BR /&gt;05-03-09&lt;BR /&gt;etc&lt;BR /&gt;&lt;BR /&gt;each of the directory /tmp/bu-logs/maaz/01-03-09, contains some files&lt;BR /&gt;&lt;BR /&gt;now I  wrote a script that is suppose to deletes all those directories(under /tmp/bu-logs/maaz, /tmp/bu-logs/riz, etc) that are older than 30 days&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/bin/bash&lt;BR /&gt;cd /tmp/bu-logs&lt;BR /&gt;for i in maaz ron kjames rts adn riz&lt;BR /&gt;do&lt;BR /&gt;   find ./ -ctime +30 -exec rm -rf {} \; &lt;BR /&gt;done&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;will the above code work ?&lt;BR /&gt;is there any mistake ?&lt;BR /&gt;please share your comments/suggestion&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Maaz</description>
      <pubDate>Thu, 05 Mar 2009 12:28:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/need-forums-suggestions-expert-opinion/m-p/4372422#M61191</guid>
      <dc:creator>Maaz</dc:creator>
      <dc:date>2009-03-05T12:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: need forums suggestions/expert opinion</title>
      <link>https://community.hpe.com/t5/operating-system-linux/need-forums-suggestions-expert-opinion/m-p/4372423#M61192</link>
      <description>Hi Maaz, I don't know why you use a for loop in that case, you could just start at the parent directory.&lt;BR /&gt;&lt;BR /&gt;Also, I would use the -mtime.&lt;BR /&gt;&lt;BR /&gt;So, the result will be:&lt;BR /&gt;&lt;BR /&gt;find /tmp/bu-logs -type f -mtime +30 -exec rm -fr {} \;</description>
      <pubDate>Thu, 05 Mar 2009 13:15:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/need-forums-suggestions-expert-opinion/m-p/4372423#M61192</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2009-03-05T13:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: need forums suggestions/expert opinion</title>
      <link>https://community.hpe.com/t5/operating-system-linux/need-forums-suggestions-expert-opinion/m-p/4372424#M61193</link>
      <description>&lt;!--!*#--&gt;My first comment/suggestion would be to use&lt;BR /&gt;a more descriptive Subject when posting a&lt;BR /&gt;question.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; will the above code work ?&lt;BR /&gt;&lt;BR /&gt;Test it and see?&lt;BR /&gt;&lt;BR /&gt;If you have any doubts, and you wish to avoid&lt;BR /&gt;deleting the wrong files, then replace "rm"&lt;BR /&gt;with something like "echo", and look at what&lt;BR /&gt;the script would have done.</description>
      <pubDate>Thu, 05 Mar 2009 14:21:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/need-forums-suggestions-expert-opinion/m-p/4372424#M61193</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2009-03-05T14:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: need forums suggestions/expert opinion</title>
      <link>https://community.hpe.com/t5/operating-system-linux/need-forums-suggestions-expert-opinion/m-p/4372425#M61194</link>
      <description>Hi thanks Ivan Ferreira for help&lt;BR /&gt;&amp;gt; I don't know why you use a for loop in that case, you could just start at the   &lt;BR /&gt;&amp;gt; parent directory.&lt;BR /&gt;Because in /tmp/bu-logs/maaz, there are directories for each day, e.g&lt;BR /&gt;/tmp/bu-logs/maaz/03-03-09&lt;BR /&gt;/tmp/bu-logs/maaz/04-03-09&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;and 03-03-09 only contains the files that was created on 03-March-2009. so I want to delete all those directories, under /tmp/bu-logs/maaz/ that are older then 30 days.&lt;BR /&gt;&lt;BR /&gt;I myself found the bug ;)&lt;BR /&gt;&lt;BR /&gt;find ./ -ctime +30 -exec rm -rf {} \; # BUG&lt;BR /&gt;&lt;BR /&gt;but following works&lt;BR /&gt;find $i/ -ctime +30 -exec rm -rf {} \;&lt;BR /&gt;&lt;BR /&gt;#!/bin/bash&lt;BR /&gt;cd /tmp/bu-logs&lt;BR /&gt;for i in maaz ron kjames rts adn riz&lt;BR /&gt;do&lt;BR /&gt;find $i/ -ctime +30 -exec rm -rf {} \;&lt;BR /&gt;done&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Also, I would use the -mtime.&lt;BR /&gt;Thanks, for the suggestion/tip&lt;BR /&gt;&lt;BR /&gt;Dear Steven Schweda &lt;BR /&gt;&amp;gt; My first comment/suggestion would be to &lt;BR /&gt;&amp;gt; use a more descriptive Subject when posting a question.&lt;BR /&gt;&lt;BR /&gt;thanks for your kind suggestion... Forum(esp  Steven Schweda) please accept apology from my side&lt;BR /&gt; &lt;BR /&gt;&amp;gt; If you have any doubts, and you wish to avoid deleting the wrong files, &lt;BR /&gt;&amp;gt; then replace "rm" with something like "echo",  and look at what the script &lt;BR /&gt;&amp;gt; would have done&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Thanks once again.&lt;BR /&gt;Regards</description>
      <pubDate>Fri, 06 Mar 2009 05:35:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/need-forums-suggestions-expert-opinion/m-p/4372425#M61194</guid>
      <dc:creator>Maaz</dc:creator>
      <dc:date>2009-03-06T05:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: need forums suggestions/expert opinion</title>
      <link>https://community.hpe.com/t5/operating-system-linux/need-forums-suggestions-expert-opinion/m-p/4372426#M61195</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;You code will hurt nothing.&lt;BR /&gt;&lt;BR /&gt;Test it.&lt;BR /&gt;&lt;BR /&gt;I like Ivan's too. &lt;BR /&gt;&lt;BR /&gt;Test his.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Fri, 06 Mar 2009 09:08:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/need-forums-suggestions-expert-opinion/m-p/4372426#M61195</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2009-03-06T09:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: need forums suggestions/expert opinion</title>
      <link>https://community.hpe.com/t5/operating-system-linux/need-forums-suggestions-expert-opinion/m-p/4372427#M61196</link>
      <description>Maaz, I think that you are confused, or I'm not having the whole picture.&lt;BR /&gt;&lt;BR /&gt;Doing a loop or not, is the same. Jumping to each directory to find files older then 30 days is the same as finding files older than 30 days on the parent directory.&lt;BR /&gt;&lt;BR /&gt;You could also specify a list of directories to find without a loop, for example:&lt;BR /&gt;&lt;BR /&gt;find maaz ron kjames rts adn riz -type f -mtime +30 -exec rm -f {} \;</description>
      <pubDate>Mon, 09 Mar 2009 13:28:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/need-forums-suggestions-expert-opinion/m-p/4372427#M61196</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2009-03-09T13:28:47Z</dc:date>
    </item>
  </channel>
</rss>

