That'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 "Directory $dir found and deleted."</div><div>
else</div><div>echo "Directory $dir not found."</div><div>fi</div><div>done < 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"><<a href="mailto:laurence@southon.uk.net">laurence@southon.uk.net</a>></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>
> Thanks Karl that was easy.<br>
><br>
> if [ -d /home/nathan/test2/123 ]<br>
> then<br>
> rm -r 123<br>
> echo "123 deleted"<br>
> else<br>
> echo "123 not found"<br>
> fi<br>
><br>
> if [ -d /home/nathan/test2/456 ]<br>
> then<br>
> rm -r 456<br>
> echo "456 deleted"<br>
> else<br>
> echo "456 not found"<br>
> fi<br>
><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 < /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>