<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blog.hio.fr &#187; find</title>
	<atom:link href="http://blog.hio.fr/tag/find/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hio.fr</link>
	<description></description>
	<lastBuildDate>Tue, 07 Sep 2010 04:42:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>BASH Comment supprimer des repertoires vide</title>
		<link>http://blog.hio.fr/2009/06/15/bash-comment-supprimer-des-repertoires-vide/</link>
		<comments>http://blog.hio.fr/2009/06/15/bash-comment-supprimer-des-repertoires-vide/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 20:17:20 +0000</pubDate>
		<dc:creator>HiO</dc:creator>
				<category><![CDATA[Dev]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[find]]></category>

		<guid isPermaLink="false">http://blog.hio.fr/?p=363</guid>
		<description><![CDATA[On question simple avec une réponse tout aussi simple, comment qu'on fais pour virer un nombre N de répertoire vide sans devoir faire un 'rm -rf' a la main pour chaque répertoire.]]></description>
			<content:encoded><![CDATA[<p>Une  question simple avec une réponse tout aussi simple, comment qu&#8217;on fais pour virer un nombre N de répertoire vide sans devoir faire un &#8216;rm -rf&#8217; a la main pour chaque répertoire.</p>
<p><strong>Le find qui sert a supprimer tous les rpertoires vide d&#8217;un repertoire</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-maxdepth</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-type</span> d <span style="color: #660033;">-empty</span> <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">sh</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">'rm -rf &quot;{}&quot; &amp;&amp; echo &quot;{}&quot; deleted'</span> \;</pre></div></div>

<p><strong>Je crée des répertoires bidon pour les tests :p</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">hio<span style="color: #000000; font-weight: bold;">@</span>fantasy:~<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span>$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">0</span>,<span style="color: #000000;">1</span>,<span style="color: #000000;">2</span>,<span style="color: #000000;">3</span>,<span style="color: #000000;">4</span>,<span style="color: #000000;">5</span>,<span style="color: #000000;">6</span>,<span style="color: #000000;">7</span>,<span style="color: #000000;">8</span>,<span style="color: #000000;">9</span>,<span style="color: #000000;">10</span>,<span style="color: #000000;">11</span>,<span style="color: #000000;">12</span>,<span style="color: #000000;">13</span>,<span style="color: #000000;">14</span>,<span style="color: #000000;">15</span>,<span style="color: #000000;">16</span>,<span style="color: #000000;">17</span>,<span style="color: #000000;">18</span>,<span style="color: #000000;">19</span>,<span style="color: #000000;">20</span>,notemptydir<span style="color: #7a0874; font-weight: bold;">&#125;</span> 
hio<span style="color: #000000; font-weight: bold;">@</span>fantasy:~<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span>$ <span style="color: #7a0874; font-weight: bold;">echo</span> maisblu <span style="color: #000000; font-weight: bold;">&gt;</span> notemptydir<span style="color: #000000; font-weight: bold;">/</span>testfile
hio<span style="color: #000000; font-weight: bold;">@</span>fantasy:~<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span>$ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span>
total <span style="color: #000000;">88</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">0</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">1</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">10</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">11</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">12</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">13</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">14</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">15</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">16</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">17</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">18</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">19</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">2</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">20</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">3</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">4</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">5</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">6</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">7</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">8</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 <span style="color: #000000;">9</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 notemptydir</pre></div></div>

<p><strong>On execute le find ^^</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">&nbsp;
hio<span style="color: #000000; font-weight: bold;">@</span>fantasy:~<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span>$  <span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-maxdepth</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-type</span> d <span style="color: #660033;">-empty</span> <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">sh</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">'rm -rf &quot;{}&quot; &amp;&amp; echo &quot;{}&quot; deleted'</span> \;
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">16</span> deleted
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">10</span> deleted
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">14</span> deleted
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">15</span> deleted
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">4</span> deleted
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">17</span> deleted
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">19</span> deleted
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2</span> deleted
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1</span> deleted
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">7</span> deleted
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">13</span> deleted
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">3</span> deleted
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">20</span> deleted
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">12</span> deleted
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span> deleted
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">18</span> deleted
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">6</span> deleted
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8</span> deleted
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">11</span> deleted
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">5</span> deleted
.<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">9</span> deleted
hio<span style="color: #000000; font-weight: bold;">@</span>fantasy:~<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span>$ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span>
total <span style="color: #000000;">4</span>
drwxr-xr-x <span style="color: #000000;">2</span> hio hio <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">15</span> <span style="color: #000000;">22</span>:09 notemptydir</pre></div></div>

<p>Voila rien de bien sorcier ^^</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hio.fr/2009/06/15/bash-comment-supprimer-des-repertoires-vide/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
