That&#39;s a good idea. thanks.<div><div><div><br></div><div><div>while read dir</div><div>do</div><div>if [ -d $dir ]</div><div>then</div><div>rm -R $dir</div><div>echo &quot;Directory $dir found and deleted.&quot;</div><div>
else</div><div>echo &quot;Directory $dir not found.&quot;</div><div>fi</div><div>done &lt; dir_list</div></div><div><br></div><div><br></div><div>dir_list file contains</div><div>/Users/user1</div><div>/Users/user2</div><div>
/Users/user3</div><div><br></div><br><div class="gmail_quote">On Fri, Jul 16, 2010 at 1:18 PM, Laurence Southon <span dir="ltr">&lt;<a href="mailto:laurence@southon.uk.net">laurence@southon.uk.net</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On 16/07/10 09:42, Nathan Friend wrote:<br>
&gt; Thanks Karl that was easy.<br>
&gt;<br>
&gt; if [ -d /home/nathan/test2/123 ]<br>
&gt; then<br>
&gt; rm -r 123<br>
&gt; echo &quot;123 deleted&quot;<br>
&gt; else<br>
&gt; echo &quot;123 not found&quot;<br>
&gt; fi<br>
&gt;<br>
&gt; if [ -d /home/nathan/test2/456 ]<br>
&gt; then<br>
&gt; rm -r 456<br>
&gt; echo &quot;456 deleted&quot;<br>
&gt; else<br>
&gt; echo &quot;456 not found&quot;<br>
&gt; fi<br>
&gt;<br>
</div>If that list of directories is long or might change, you could put it in<br>
a file /home/nathan/dir_list, one per line, and then make the script<br>
loop through the list of entries:<br>
<br>
while read dir<br>
<br>
do<br>
<br>
if [ -d $dir ]<br>
then<br>
.<br>
<br>
.<br>
fi<br>
done &lt; /home/nathan/dir_list<br>
<br>
Then you just need to change dir_list and not the script.<br>
<br>
LS<br>
<font color="#888888">--<br>
Laurence Southon<br>
Tiger Computing, Bexley<br>
<a href="http://www.tiger-computing.co.uk" target="_blank">www.tiger-computing.co.uk</a><br>
</font><div><div></div><div class="h5"><br>
_______________________________________________<br>
Kent mailing list<br>
<a href="mailto:Kent@mailman.lug.org.uk">Kent@mailman.lug.org.uk</a><br>
<a href="https://mailman.lug.org.uk/mailman/listinfo/kent" target="_blank">https://mailman.lug.org.uk/mailman/listinfo/kent</a><br>
</div></div></blockquote></div><br></div></div>