<?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 empty directory in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-empty-directory/m-p/5160352#M456211</link>
    <description>I dont think I can do it with 1 command, you will need a script.&lt;BR /&gt;&lt;BR /&gt;for DIR in $(find /usr1 -type d - mtime +30)&lt;BR /&gt;do&lt;BR /&gt;  cd $DIR&lt;BR /&gt;  EMPTY=`ls`&lt;BR /&gt;  if [[ $EMPTY = "" ]]&lt;BR /&gt;  then &lt;BR /&gt;&lt;BR /&gt;    rm $DIR&lt;BR /&gt;  fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;You will need to tweak this before running on a live system. I am not in front of a unix box to get the commands exactly.</description>
    <pubDate>Mon, 02 Mar 2009 08:09:52 GMT</pubDate>
    <dc:creator>Mark McDonald_2</dc:creator>
    <dc:date>2009-03-02T08:09:52Z</dc:date>
    <item>
      <title>Remove empty directory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-empty-directory/m-p/5160349#M456208</link>
      <description>Hi ,&lt;BR /&gt;&lt;BR /&gt;Can anyone tell me how to remove empty directories which are created before 30 days .&lt;BR /&gt;ie i have to remove empty directores from /usr1 filesystem.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Mon, 02 Mar 2009 06:45:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-empty-directory/m-p/5160349#M456208</guid>
      <dc:creator>Mah_1</dc:creator>
      <dc:date>2009-03-02T06:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: Remove empty directory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-empty-directory/m-p/5160350#M456209</link>
      <description>Hi mah,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Please execute the following command:&lt;BR /&gt;&lt;BR /&gt;enter the diectory and execute: ls -al&lt;BR /&gt;&lt;BR /&gt;If the directory is empty then execute:&lt;BR /&gt;&lt;BR /&gt;rm -rf /user1&lt;BR /&gt;&lt;BR /&gt;Rgds-kranti</description>
      <pubDate>Mon, 02 Mar 2009 07:07:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-empty-directory/m-p/5160350#M456209</guid>
      <dc:creator>Kranti Mahmud</dc:creator>
      <dc:date>2009-03-02T07:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: Remove empty directory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-empty-directory/m-p/5160351#M456210</link>
      <description>There are lakhs of directories.&lt;BR /&gt;i want a command which will find out and delete those dirs.</description>
      <pubDate>Mon, 02 Mar 2009 07:21:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-empty-directory/m-p/5160351#M456210</guid>
      <dc:creator>Mah_1</dc:creator>
      <dc:date>2009-03-02T07:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: Remove empty directory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-empty-directory/m-p/5160352#M456211</link>
      <description>I dont think I can do it with 1 command, you will need a script.&lt;BR /&gt;&lt;BR /&gt;for DIR in $(find /usr1 -type d - mtime +30)&lt;BR /&gt;do&lt;BR /&gt;  cd $DIR&lt;BR /&gt;  EMPTY=`ls`&lt;BR /&gt;  if [[ $EMPTY = "" ]]&lt;BR /&gt;  then &lt;BR /&gt;&lt;BR /&gt;    rm $DIR&lt;BR /&gt;  fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;You will need to tweak this before running on a live system. I am not in front of a unix box to get the commands exactly.</description>
      <pubDate>Mon, 02 Mar 2009 08:09:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-empty-directory/m-p/5160352#M456211</guid>
      <dc:creator>Mark McDonald_2</dc:creator>
      <dc:date>2009-03-02T08:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Remove empty directory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-empty-directory/m-p/5160353#M456212</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Mark gave you the find command.&lt;BR /&gt;Do delete empty dirs check the command 'rmdir' - this command deletes empty directories (see 'man rmdir').&lt;BR /&gt;&lt;BR /&gt;make a test before ...&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;Volkmar&lt;BR /&gt;</description>
      <pubDate>Mon, 02 Mar 2009 08:21:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-empty-directory/m-p/5160353#M456212</guid>
      <dc:creator>V. Nyga</dc:creator>
      <dc:date>2009-03-02T08:21:09Z</dc:date>
    </item>
    <item>
      <title>Re: Remove empty directory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-empty-directory/m-p/5160354#M456213</link>
      <description>all in one:&lt;BR /&gt;&lt;BR /&gt;find /usr1 -type d -mtime +30 -depth -exec rmdir {} \; 2&amp;gt;/dev/null</description>
      <pubDate>Mon, 02 Mar 2009 09:01:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-empty-directory/m-p/5160354#M456213</guid>
      <dc:creator>Matthias Zander</dc:creator>
      <dc:date>2009-03-02T09:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: Remove empty directory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-empty-directory/m-p/5160355#M456214</link>
      <description>thanks</description>
      <pubDate>Mon, 02 Mar 2009 11:53:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-empty-directory/m-p/5160355#M456214</guid>
      <dc:creator>Mah_1</dc:creator>
      <dc:date>2009-03-02T11:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: Remove empty directory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-empty-directory/m-p/5160356#M456215</link>
      <description>&amp;gt;Matthias: find /usr1 -type d -mtime +30 -depth -exec rmdir {} \; 2&amp;gt;/dev/null&lt;BR /&gt;&lt;BR /&gt;You might want to just redirect rmdir errors and not find errors.  And use + for performance:&lt;BR /&gt;find /usr1 -type d -mtime +30 -depth -exec rmdir {} 2&amp;gt; /dev/null +</description>
      <pubDate>Mon, 02 Mar 2009 17:28:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-empty-directory/m-p/5160356#M456215</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-03-02T17:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: Remove empty directory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/remove-empty-directory/m-p/5160357#M456216</link>
      <description>&amp;gt;ME: You might want to just redirect rmdir errors and not find errors. &lt;BR /&gt;&lt;BR /&gt;Oops, the only way to get this to work is to create a script to do the rmdir and then redirect stderr:&lt;BR /&gt;find /usr1 -type d -mtime +30 -depth -exec rmdir_script {} +&lt;BR /&gt;&lt;BR /&gt;rmdir_script:&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;rmdir "$@" 2&amp;gt; /dev/null&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 02 Mar 2009 23:12:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/remove-empty-directory/m-p/5160357#M456216</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-03-02T23:12:44Z</dc:date>
    </item>
  </channel>
</rss>

