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>Cheers,<br><br>Nathan.<br><br><div class="gmail_quote">On Fri, Jul 16, 2010 at 9:23 AM, Karl Lattimer <span dir="ltr"><<a href="mailto:karl@qdh.org.uk">karl@qdh.org.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">On Fri, 2010-07-16 at 09:17 +0100, Nathan Friend wrote:<br>
> Morning,<br>
> I would like a simple bash script to check if a list of user<br>
> directories exist and if they do delete them. If they don't output a<br>
> message and skip to next folder to check. E.g.<br>
><br>
> Does /Home/user1 exist > Yes > Delete /home/user1 goto next check<br>
> No > "user1 not found" go to<br>
> next check<br>
> Does /Home/user2 exist > Yes > Delete home/user2 goto next check<br>
> No > "user2 not found" go to<br>
> next check<br>
> end.<br>
><br>
> Any ideas how I can do this?<br>
<br>
</div></div>if [ -d /path/to/dir ]<br>
then<br>
echo "exists"<br>
fi<br>
<br>
K,<br>
<br>
><br>
> Cheers,<br>
><br>
> Nathan.<br>
><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>
<br>
<br>
<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>
</blockquote></div><br>